Click here to Skip to main content
15,895,423 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
all links point on this:
while((c = is.read()) != -1) {
   // do something with the response
}

but this conception seems like wrong, because this loop is ENDLESS, I also tried to send by server "-1" after response - not helped. I confused.
[Just trying to receive a response from the server]
Posted
Updated 4-Aug-10 11:15am
v5

well -1 is not that same as "-1". What are you reading? What does is.read() return when it reaches EOF? that is what you want to look for.
 
Share this answer
 
What does is.read() return when it reaches EOF?
is.read() returns 255 when string was ended, but:
- 
while((c = is.read()) != 255) {
   // do something with the response
}

is not a good solution.
I think the single way is to transfer by server LENGTH of string, and then, the string.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900