HOW to terminate the thread when the client socket is closed
843790Sep 12 2008 — edited Sep 15 2008HI,
We are developing a Socket application ,
Server socket will accept the client connections.
For every client connection we will create a thread , this thread will always try to read the messages from the client socket.
here the problem is once the client connection is closed , we are not able to close the thread which is reading the client messages .
because of this , how many number of times the client is disconnected those many threads are unnecessarily running.
we are using socket.isClosed() method , its not helpful , once the connection is closed also it is showing its connected.
after writing some 0 bites to the client socket then only it is giving the exception like client is closed.
[ is there any disadvantage of writing the 0(0x00) bytes to the socket outputstream. ]
and how can i close the thread when the client is disconnected.
i will be very thank full for your reply.
Thanks,
S P K S.