Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

socket problem, plz help

 
ezzat Al Hakeem
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22542
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!