Which java socket threw the Connection reset IOException?
I am trying a client-server application in Java. One of the threads in Server is responsible for listening and accepting connections from multiple clients. For every connection accepted, this thread keeps appending the new client socket object into a socket-list that it maintains. Suppose after a while the Server is connected to 10 clients. Now if the 4th client closes the connection an IOException will be thrown with "Connection reset" message.
Is there a way for the Server to find out which of the sockets, out of the 10, threw this exception? (in this case the 4th socket)
I don't want to create separate thread for each connection.
Is my approach wrong? Appreciate any help.
链接地址: http://www.djcxy.com/p/56574.html