Java NIO SocketChannel writing problem

Posted by Nilesh on Stack Overflow See other posts from Stack Overflow or by Nilesh
Published on 2010-04-27T07:38:58Z Indexed on 2010/04/27 7:43 UTC
Read the original article Hit count: 353

Filed under:
|
|

I am using Java NIO's SocketChannel to write : int n = socketChannel.write(byteBuffer); Most of the times the data is sent in one or two parts; i.e. if the data could not be sent in one attemmpt, remaining data is retried.

The issue here is, sometimes, the data is not being sent completely in one attempt, rest of the data when tried to send multiple times, it occurs that even after trying several times, not a single character is being written to channel, finally after some time the remaning data is sent.

What could be the cause of such behaviour? Could external factors such as RAM, etc cause the hindarance?

Please help me solve this issue. If any other information is required please let me know.

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about nio