Type |
Bug
|
Priority |
Normal
|
Assignee | |
RedmineID |
2075
|
Spent time |
3h
|
Issue Votes (0)
Watchers (0)
Type |
Bug
|
Priority |
Normal
|
Assignee | |
RedmineID |
2075
|
Spent time |
3h
|
I think it should be a bug when I reading source code of SocketIO.The code fragment is in write() method:
res = channel.write(tmp);
In java.nio.channels.WritableByteChannel#write(),it comments like this:
Unless otherwise specified, a write operation will return only after
writing all of the r requested bytes. Some types of channels,
depending upon their state, may write only some of the bytes or possibly
none at all. A socket channel in non-blocking mode, for example, cannot
write any more bytes than are free in the socket's output buffer.
It hasn't illustrate clearly whether all data can be wrote when SocketChannel is in unblocking status.So I think the more strict code should like this:
while(tmp.hasRemaining()){channel.write(tmp);}