-
JAVA NIO DatagramChannel (2 messages)
- Posted by: Senthil S
- Posted on: February 24 2007 17:35 EST
In the statement, for(Iterator i =readyKeys,iterator();i.hasNext();) SocketAddress sock = channel.receive(bytebuffer); the SocketAddress is sometimes null , even while iterating throught the readyKeys (selector.selectedKeys() Set). Could this be a bug in NIO?Threaded Messages (2)
- Re: JAVA NIO DatagramChannel by Cameron Purdy on February 27 2007 07:04 EST
- Re: JAVA NIO DatagramChannel by Senthil S on April 02 2007 07:30 EDT
-
Re: JAVA NIO DatagramChannel[ Go to top ]
- Posted by: Cameron Purdy
- Posted on: February 27 2007 07:04 EST
- in response to Senthil S
The documentation states:If this channel is in non-blocking mode and a datagram is not immediately available then this method immediately returns null.
When you use NIO, your NIO-related code needs to be fairly tolerant of conditions such as this. Peace, Cameron Purdy Tangosol Coherence: The Java Data Grid -
Re: JAVA NIO DatagramChannel[ Go to top ]
- Posted by: Senthil S
- Posted on: April 02 2007 07:30 EDT
- in response to Cameron Purdy
I did handle for the null condition as stated in the java documentation. But practically, the application seems to be dropping the packets, which I confirmed using the wireShark/Ethereal application This happens only in a few variants of linux like Ubuntu etc.