have a look at the buffering of reading the tcp input stream
have a look at the buffering of reading the tcp input stream