I've added a line of code to exit the app when the JFrame is closed. Also, a listener for when the frame gets closed that's supposed to close the socket.
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.addWindowListener(new myListener());
class myListener implements WindowListener {
public void windowClosing(WindowEvent e) {
System.out.println("Window Closing, closing socket");
try{
sock.close();
} catch(IOException ex) {
System.out.println("Error closing socket");
}
}
}
But, I get errors when I close the frame, because I think,
the readerThread is still trying to read from a socket that's closed.
Has anyone modified the code so that the app closes cleanly?
Regards
Richard


















