| Author |
socket problem, plz help
|
ezzat Al Hakeem
Greenhorn
Joined: Sep 06, 2006
Posts: 1
|
|
my problem is I have socket between server and a client the client sending data to the server, so the server respond to the client with the response this my code for receive the response data look to the code, you can notice that I have 2 variables (nn) and (rr) nn is the avialbe bytes in the InbutStream and rr is the nubmer of byes did read from the InbutStream. when i make a debug , nn = 8192 and rr = 22233 !!! the question is HOW can I read _ALLl _ the received data from the InbutStream waiting your help
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16681
|
|
the question is HOW can I read _ALLl _ the received data from the InbutStream
The available() method returns the number of bytes that can be read *without* blocking. The read() method *blocks* until it reads enough to fill the array, or an EOF is encountered. If you only want to read the available bytes, then you need to either... read a byte at a time, or read into a part of the array. See the inputstream javadoc for more information. Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
 |
|
|
subject: socket problem, plz help
|
|
|