Page 1 of 1

Reconnect if disconnected

Posted: Sat Apr 04, 2020 4:51 am
by theyaggie
So often if I leave Mudlet active during the night I will notice in the morning that it has disconnected:

[ ALERT ] - Socket got disconnected.
Reason: Unknown error

I am not interested about whether it's some router issue but I want to know is there a simple way to do reconnect when that message is printed? As in most cases I am not losing internet connection when this disconnect happens. I do have "Reconnect automatically" selected in profile but it does not seem to work as if I simply choose disconnect from menu and it doesn't reconnect. I also tried to do trigger which runs that first row and then calls alias which calls myfunction which calls reconnect() but that did not work so I guess normal triggers do not run those [ ALERT ] rows.

Re: Reconnect if disconnected

Posted: Sat Apr 04, 2020 11:46 am
by Vadi
> I do have "Reconnect automatically" selected in profile but it does not seem to work as if I simply choose disconnect from menu and it doesn't reconnect

That's intended - otherwise you'd never be able to disconnect. It is supposed to reconnect you in the case that your router shuts off the connection, though!

Re: Reconnect if disconnected

Posted: Sat Apr 04, 2020 7:42 pm
by theyaggie
I play Zombiemud which reboots its server in every 24 hours. Connection is then closed by

[ ALERT ] - Socket got disconnected.
Reason: The remote host closed the connection

But "reconnect automatically" does not work in that case either. I wonder why? Is there anything I can check?

Re: Reconnect if disconnected

Posted: Sun Apr 05, 2020 5:18 am
by atari2600tim
theyaggie wrote:
Sat Apr 04, 2020 7:42 pm
I play Zombiemud which reboots its server in every 24 hours. Connection is then closed by

[ ALERT ] - Socket got disconnected.
Reason: The remote host closed the connection

But "reconnect automatically" does not work in that case either. I wonder why? Is there anything I can check?
I think the reconnect checkbox will only reconnect when it suddenly discovers that it is not getting a response from the server.

But if the server sent you some bits indicating that closing the connection was intentional (because you had typed 'quit', or because the game is shutting down), then it does not try to reconnect.

Since you're getting "The remote host closed the connection", that sounds like your client didn't just stop hearing from the server, but was given those goodbye bits.

Someone on the Discord asked this same question a few weeks ago, and this thread sounds like it helped them: viewtopic.php?t=22448

Re: Reconnect if disconnected

Posted: Sun Apr 05, 2020 11:37 am
by theyaggie
atari2600tim wrote:
Sun Apr 05, 2020 5:18 am
I think the reconnect checkbox will only reconnect when it suddenly discovers that it is not getting a response from the server.

But if the server sent you some bits indicating that closing the connection was intentional (because you had typed 'quit', or because the game is shutting down), then it does not try to reconnect.

Since you're getting "The remote host closed the connection", that sounds like your client didn't just stop hearing from the server, but was given those goodbye bits.

Someone on the Discord asked this same question a few weeks ago, and this thread sounds like it helped them: viewtopic.php?t=22448
Thank you! Managed to get automatic reconnect to work by using that link's example :)