Reading from an Socket and it hands at in.readline()!=null
saumil baxi
Ranch Hand
Joined: Apr 18, 2008
Posts: 58
posted
0
Hi,
I am writing a simple server client application,
at the server end whenever a client connects , server reads data and response back
but the server gets hang at bufferin.readline()
What is the best way to avoid if the client doesn't send an EOM. how to tell the server to stop reading from the Stream.
Ugh, no it wasn't. Thanks for pointing that out. I can't believe they removed that article - at least it looks like they did, I can't find it on their site now. The Japanese version is still there :-)
The bottom line is: one can't reliably use "println" and "readLine" with sockets due to those methods using the default line ending that is appropriate for the platform the code runs on. Most protocols (HTTP, for example) use "\r\n" for line endings, though.