- (tcp-connect HOSTNAME [TCPPORT ENCODING])procedure
Establishes a client-side TCP connection to the machine with the name HOSTNAME (a string) at TCPPORT (an exact integer) and returns two values: an input- and output-port for communicating with the remote process. The current value of tcp-connect-timeout is used to determine the maximal number of milliseconds (if any) to wait until the connection is established. When the connection takes place any read- and write-operations on the returned ports will use the current values (at the time of the call to tcp-connect) of tcp-read-timeout and tcp-write-timeout, respectively, to determine the maximal number of milliseconds to wait for input/output before a timeout error is signalled.
If the TCPPORT is omitted, the port is parsed from the HOSTNAME string. The format expected is HOSTNAME:PORT. The PORT can either be a string representation of an integer or a service name which is translated to an integer using the POSIX function getservbyname.
ENCODING should be a symbol specifying the encoding to be used for I/O operations, the default is utf-8. The encodings for the returned in and output ports can be subsequently changed by using the port-encoding setter.
Note: any I/O on the ports returned will not block other running threads.