• Post Reply Bookmark Topic Watch Topic
  • New Topic

Socket and disconected client

 
Rafal Chmielecki
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone
My problem reffers to some code in wchich I have opened some sockets between server and it's clients. Each client works on different thread (theres an infinite loop which talks with client). Mostly I do connect to this server from telnet.
My problem is: when client disconect, thread, which works for this client doesnt close. (i know why: there's an infinite loop). But my question is: how to get information from object java.net.socket, that client has disconected itself?
best regards (and Merry Christmas)
Rafal Chmielecki
 
Shubhrajit Chatterjee
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rafal Chmielecki:
Hello everyone
My problem reffers to some code in wchich I have opened some sockets between server and it's clients. Each client works on different thread (theres an infinite loop which talks with client). Mostly I do connect to this server from telnet.
My problem is: when client disconect, thread, which works for this client doesnt close. (i know why: there's an infinite loop). But my question is: how to get information from object java.net.socket, that client has disconected itself?
best regards (and Merry Christmas)
Rafal Chmielecki

If you do I/O on a socket which has been closed you get a broken pipe exception (in UNIX) or SocketException con reset by peer on NT. Handle these to terminate your thread.

------------------
Shubhrajit
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!