How can I reconnect with code

Posted by Tianxz on Thu 20 May 2010 03:25 PM — 3 posts, 13,496 views.

#0
The code can't reconnect:

$world->Execute('quit');
$world->connect();

How can I revise it.
USA #1
It's Connect, not connect. Function names are case sensitive.
Australia Forum Administrator #2
Your first line sends a quit command to the MUD. Then, before the MUD has a chance to do anything you reconnect.

TCP/IP is a stream protocol. Things take time. For example, it might take half a second for your command to reach the MUD, another half second for it to process it, and another half second for the disconnection to reach the client.

What you really want to do is quit, and then have a "reconnector" script that reconnects if it happens to get disconnected. There are some plugins that do that.