Hello, I am trying to create a server for a card game I wrote. Starting the server and connecting onto it works fine, however when I'm about shut it down I get a SocketException : Socket closed and my application cannot recover from this. I found the cause of this to be the accept() method from ServerSocket class, because it is blocking. I am calling the accept() method in a while(!socket.isClosed()) loop on a runnable server. I would like to know how I can recover the server from this blocking state or at least handle this specific exception so my application won't freeze. I will post code on demand. Any help is appreciated.
#How to properly close a ServerSocket on a threaded server.
3 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @leaden drift! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.