This is the mail archive of the
mailing list for the Java project.
Re: [PATCH]: DatagramChannel + Misc. Channel Fixes
- From: Mohan Embar <gnustuff at thisiscool dot com>
- To: Michael Koch <konqueror at gmx dot de>
- Cc: GCJ Patches <java-patches at gcc dot gnu dot org>
- Date: Tue, 03 Feb 2004 09:37:13 -0600
- Subject: Re: [PATCH]: DatagramChannel + Misc. Channel Fixes
- Reply-to: gnustuff at thisiscool dot com
>> Here you go....
>Now I go ...
>> - int len = dst.remaining();
>> + int len = dst.capacity() - dst.position();
>Why is this needed ? This means that we write probably more data into
>the buffer then is suitable. I think we have to honor limit(). This is
>automatically done by using remaining().
>Can you write a little example proving I'm wrong ? (not that big NetTest
dst.remaining() means that there are dst.remaining() bytes in the buffer
and we want to do something with them. That isn't the case here. Here,
we want to put data into the buffer and dst.capacity() - dst.position() is
the number of bytes we're allowed to store into the buffer.