world.IsConnected

MUSHclient script function (Method)

Tests to see if the world is connected to the MUD server

Prototype

boolean IsConnected();

Data type meanings

Description

This returns TRUE if the world is currently connected.

See GetInfo (227) for more details about the exact connection status.

There are actually a number of connection "phases" because connection is not synchronous. That is, connecting takes time.

If you are using a proxy server, with a username/password, there are 8 phases as described below. Not all phases are necessarily done, for example if the MUD address is already a "dotted decimal" number then a MUD name lookup is not required.

They are:

0=not connected (and not attempting to connect)
1=MUD name lookup (converting MUD name to an IP address)
2=Proxy server name lookup (converting proxy server name to an IP address)
3=connecting to MUD (establishing TCP/IP connection to the MUD)
4=connecting to proxy server (establishing TCP/IP connection to the proxy server)
5=proxy server phase 1 (sent SOCKS authentication method, awaiting confirmation)
6=proxy server phase 2 (sent SOCKS username/password, awaiting confirmation)
7=proxy server phase 3 (sent SOCKS connect details, awaiting confirmation)
8=connected to MUD (fully connected)

Strictly speaking, IsConnected returns true if the connection phase is 8 (connected to MUD) and false for any other phase.

VBscript example

world.note world.IsConnected

Jscript example

world.note(world.IsConnected());

PerlScript example

$world->note($world->IsConnected());

Python example

world.note(world.IsConnected)

Lua example

Note(IsConnected())

Return value

TRUE if world connected
FALSE if not connected

Note: TRUE is a non-zero value, FALSE is the value 0.

Related topic

Information

See also

FunctionDescription
ConnectConnects the world to the MUD server
DisconnectDisconnects the world from the MUD server
GetConnectDurationReturns the number of seconds this world has been connected.
GetInfoGets information about the current world