Hi all,
Could someone explain to me the following phenomenon:
I opened a socket and sent data successfully with the following lines:
BufferedWriter wr = new BufferedWriter(new
OutputStreamWriter(m_socket.getOutputStream()));
wr.write(m_data);
When I want to receive a response with the following line:
BufferedReader rd = new BufferedReader(new
InputStreamReader(m_socket.getInputStream()));
I get an exception that the socket is closed, even though I didn't
close it explicitly.
Did I miss something?
Please help.
Thanks, Lior
Stefan Schulz - 30 Aug 2004 14:49 GMT
> Hi all,
>
[quoted text clipped - 8 lines]
> I get an exception that the socket is closed, even though I didn't
> close it explicitly.
Did the remote side close the Socket? Sorry, but this is the simplest
answer that comes to mind ;)
See you
Stefan
Gordon Beaton - 30 Aug 2004 15:03 GMT
> Could someone explain to me the following phenomenon:
> I opened a socket and sent data successfully with the following lines:
[quoted text clipped - 9 lines]
>
> Did I miss something?
My guess is that you closed the BufferedOutputStream. Doing so will
close the OutputStreamWriter and the underlying Socket.
/gordon

Signature
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e