You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Adam Fisk <a...@lastbamboo.org> on 2007/08/23 00:53:44 UTC

UDP datagrams write and receive

I'm wondering if anyone knows if there are guarantees that a each call to
DatagramChannel.write(ByteBuffer src) *always* results in the sending of a
single datagram.  In all my tests this is the case, but I'm not sure if it's
operating system-specific.

More specifically, can 2 calls to DatagramChannel.write(ByteBuffer src) get
consolidated into the sending of a single datagram on the wire?  I know the
DatagramChannel.write(ByteBuffer[] srcs) call will consolidate them, but it
at least appears that calling write for individual buffers sends each in its
own datagram.

Possibly I shouldn't rely on this behavior?  Anyone have any experience with
this?

Thanks.

-Adam

Re: UDP datagrams write and receive

Posted by Adam Fisk <a...@lastbamboo.org>.
OK great.  I think I'll go with that assumption and just fix it if I ever
see it break, in which case I'll report back.

Many thanks.

-Adam


On 8/22/07, Trustin Lee <tr...@gmail.com> wrote:
>
> On 8/23/07, Adam Fisk <a...@lastbamboo.org> wrote:
> > I'm wondering if anyone knows if there are guarantees that a each call
> to
> > DatagramChannel.write(ByteBuffer src) *always* results in the sending of
> a
> > single datagram.  In all my tests this is the case, but I'm not sure if
> it's
> > operating system-specific.
> >
> > More specifically, can 2 calls to DatagramChannel.write(ByteBuffer src)
> get
> > consolidated into the sending of a single datagram on the wire?  I know
> the
> > DatagramChannel.write(ByteBuffer[] srcs) call will consolidate them, but
> it
> > at least appears that calling write for individual buffers sends each in
> its
> > own datagram.
> >
> > Possibly I shouldn't rely on this behavior?  Anyone have any experience
> with
> > this?
>
> AFAIK, you are safe to assume one write call sends a single datagram.
>
> HTH,
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>

Re: UDP datagrams write and receive

Posted by Trustin Lee <tr...@gmail.com>.
On 8/23/07, Adam Fisk <a...@lastbamboo.org> wrote:
> I'm wondering if anyone knows if there are guarantees that a each call to
> DatagramChannel.write(ByteBuffer src) *always* results in the sending of a
> single datagram.  In all my tests this is the case, but I'm not sure if it's
> operating system-specific.
>
> More specifically, can 2 calls to DatagramChannel.write(ByteBuffer src) get
> consolidated into the sending of a single datagram on the wire?  I know the
> DatagramChannel.write(ByteBuffer[] srcs) call will consolidate them, but it
> at least appears that calling write for individual buffers sends each in its
> own datagram.
>
> Possibly I shouldn't rely on this behavior?  Anyone have any experience with
> this?

AFAIK, you are safe to assume one write call sends a single datagram.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6