Bookmark Topic Watch Topic
  • New Topic

Length of the Socket Input Stream to Read 'OR' End of the Socket Stream

 
Maheshwari Anuj
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi All,

I have to read a response from a TCP Socket's Input Stream. But I dont know the number of bytes that are coming in response. There is a function called available() that gives the number of bytes available in the stream, but its not reliable, it works some time and sometime not. I also tried to read data till I found "-1" which marks the end of the stream but this is also not working beacuse I think at the server end streams are not getting closed that why I am not getting "-1". Please Help.

Regards,
Anuj Maheshwari
 
Rob Spoor
Sheriff
Pie
Posts: 20546
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please Use One Thread Per Question. You asked the same question here.

I'm sure Joe doesn't mind if I close this thread.
 
    Bookmark Topic Watch Topic
  • New Topic