Q
Qu0ll
I am using non-blocking NIO with SocketChannel to send data from a server to
a client in "packets". Now, I thought that if I send 3 packets of 1024
bytes each and then call read() at the other end 3 times I would be able to
read 3 separate packets. However, it seems that the underlying protocol
knows nothing about the packet structure so the packets get glued together
and just one read() call on the client may read all 3 packets at once.
Is this correct? If so, how can I delimit packets and have a separate read
for each one? Or is it a case of reading whatever's available and then
breaking it up on the client side using some special byte value?
--
And loving it,
-Q
_________________________________________________
(e-mail address removed)
(Replace the "SixFour" with numbers to email me)
a client in "packets". Now, I thought that if I send 3 packets of 1024
bytes each and then call read() at the other end 3 times I would be able to
read 3 separate packets. However, it seems that the underlying protocol
knows nothing about the packet structure so the packets get glued together
and just one read() call on the client may read all 3 packets at once.
Is this correct? If so, how can I delimit packets and have a separate read
for each one? Or is it a case of reading whatever's available and then
breaking it up on the client side using some special byte value?
--
And loving it,
-Q
_________________________________________________
(e-mail address removed)
(Replace the "SixFour" with numbers to email me)