I have a listening port on my server that I connect to using the Java class and interface Socket, i.e.
Socket mySocket = new Socket(host,port);
Then I grab OutputStream, decorate PrintWriterin autorun mode, and I laugh - except that the listening port closes. Then i get
tcp4 0 0 *.9999 *.* LISTEN
tcp 0 0 127.0.0.1.45737 127.0.0.1.9999 CLOSE_WAIT
and I canโt detect the problem in the program - I tried to use the method isConnected()on the socket, but I donโt seem to know that the connection is closed.
I want to know about the problem the next time I start and write to Socket so that I can try to reconnect and report the problem.
Any tips please?
Thank you all
source
share