/connect

Usage:

/CONNECT [-lq] [world]
/CONNECT host port


Attempts to open a socket connected to world. World must be defined by the /addworld command and not already connected. If world is omitted, the first defined world will be used. If world does not have a host and port, /connect will create a "connectionless" socket. In the form "/connect host port", it will define a temporary world named "(unnamedN)" with the given address, and try to connect to it. Host may be an internet hostname, an IPv4 address, or (if your platform supports it) an IPv6 address. A temporary world will be undefined when it is no longer in use.

Options:

-l
No automatic login (i.e., don't call the LOGIN hook).
-q
Quiet login (overrides %{quiet} flag).
-x
Connect using SSL (not necessary if world was defined with the "x" flag).
When a new socket is created and (unless it is connectionless) its network connection is successfully made, these events occur:

When a hostname is given, TF must resolve it to an IP address. If %{gethostbyname} is "nonblocking" (the default), and this process takes too long, TF will print "Hostname resolution for world in progress" (the PENDING hook) and continue to work in the background, leaving you free to do other things. If the resolution succeeds, TF will try to connect; if it fails, you will be notified.

On most platforms, if %{connect} is "nonblocking" (the default) and the connection takes too long, TF will print "Connection to world in progress" (the PENDING hook) and continue to try to connect in the background, leaving you free to do other things. If the connection eventually succeeds, you will be switched to that socket (but see note below); if it fails, you will be notified.

Even if %{gethostbyname} and/or %{connect} are "blocking", they can be interrupted with the SIGINT signal (^C).

When a pending /connect succeeds, the foregrounding is done by a CONNECT hook defined by the standard library. If you don't want to switch automatically, you can either delete the default hook (/undef ~connect_switch_hook) or define your own (with a priority higher than 0). If you define your own but you still want the switch to occur, you must either make it a fall-thru, or explicitly call "/fg %1" from your hook.

If you have trouble connecting (especially if you use SOCKS), try setting connect=blocking.

If your host has multiple network interfaces, the OS will choose one of them for the client end of the connection according to its own rules. To override the system's choice, set the tfhost variable or define the world with a srchost parameter to addworld.

/connect returns 0 on error or failure, 1 on success, or 2 if the connection is pending.

See: worlds, sockets, proxy, /world, /addworld, /fg, /retry, %login, %gethostbyname, %connect, hooks procotols


Back to index
Back to tf home page
Copyright © 1995, 1996, 1997, 1998, 1999, 2002, 2003 Ken Keys