Need help with handling disconnects on my socket server.
I've been looking for a way to properly handle disconnects / timeouts on my socket server for hours. All I wanted to do was log a disconnect message and un-authenticate them if they are authenticated.
Here is my code (see line 79, it currently does nothing):
https://github.com/erenkarakal/Chiroptera/blob/master/src/main/java/me/eren/chiroptera/ChiropteraServer.java
3 Replies
⌛
This post has been reserved for your question.
Hey @eren.! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
turns out line 53 is supposed to return -1 if the client disconnected but adding an
if (bytesRead == -1)
check and handling disconnect in it doesnt do anything either💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.