TheHolyWaffle / TeamSpeak-3-Java-API

A Java wrapper of TeamSpeak's 3 server query API.
MIT License
306 stars 107 forks source link

Socket Timeout Exception: Read timed out #377

Closed MartinWagenbach closed 10 months ago

MartinWagenbach commented 3 years ago

Guten Morgen,

ich habe das Problem, dass mein Bot nach einer gewissen Zeit die Verbindung verliert.

Mit freundlichem Gruß, Martin Wagenbach

Fehlermeldung

https://pastebin.com/uBK80vDk

Code

de.mimnu.daddeleckets3bot.support.SupportChannel: https://pastebin.com/HvZdHZ1D

de.mimnu.daddeleckets3bot.afkmover.AfkMover: https://pastebin.com/Hm0LBkix

Kakifrucht commented 3 years ago

That's simply a timeout and doesn't give any further information about what went wrong. If you were connected on localhost a timeout really shouldn't happen, but still could.

Best thing you can do is add reconnect listeners to your bot to stop the Timer tasks after a disconnect happens, and after a successful reconnect restart them.

See this example: https://github.com/TheHolyWaffle/TeamSpeak-3-Java-API/blob/master/example/ReconnectExample.java

Likqez commented 3 years ago

Also provide code snippets as a gisthub gist so it does not invalidate after time. The pastebin links dont work anymore :)