944,047 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 823
  • Java RSS
Oct 21st, 2007
0

socket problem,,,,, plz help

Expand Post »
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
----------------------------------------------------------
os.write(getAuthenticationRedGreenInfoString());
os.flush();
Thread.sleep(3000);
DataInputStream is = new DataInputStream(mySocket.getInputStream());
int rr;
int nn = is.available();
if(nn > 0)
{
byte[] bb = new byte[100000];
rr = is.read(bb); / / rr is Number of read bytes
}
--------------------------------------------------------------------

look to the code, u 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 ur help
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ezzat_hakeem is offline Offline
1 posts
since Oct 2007
Oct 22nd, 2007
0

Re: socket problem,,,,, plz help

Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 839
Posting Genius
Ezzaral is offline Offline
6,761 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Sql + Java
Next Thread in Java Forum Timeline: Help with subclasses and Methods





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC