hakan eryargi a écrit :
ok but DataInputStream.readInt(), ObjectInputStream.readObject() and similar methods take care of that, right ? they block until necessary amount of data is available in the underlying stream. that's why i used DataInputStream.readInt() to skip size block instead of read(new byte[4]).
Hmmm... I have overlooked this part of your code
the thing here is, DataInputStream or ObjectInputStream somehow skips a *full *block in stream. it's a full block othrwise we would get a StreamCorrupted or similar exceptions..
What about the fact that you could have more than one message in the incming buffer ? In this case, you have to loop until all the messages has been processed.
