User guide
137
Tcp
rcvbufsz arg1: sock arg2: sz
This sets the receive buffer size of the given socket to size bytes. A zero resu l t
indicates success.
Tcp
bind arg1: sock arg2: ipaddr arg3: port
This assi gns local host and port numbers to the specified socket. A zero result
indicates success.
Tcp
connect arg1: sock arg2: ipaddr arg3: port arg4: timeout
This attempts to establish a connection to a remote host via the given socket within
the given timeout. If timeout is greater than zero it specifies a timeout time in milli-
seconds, if it is zero there i s no timeout and if it is -1 polling will be used but thi s
is not yet implemented. The result is zero if a connec ti on was established, otherwise
it is negative and the second resu l t indicates why the connec ti on was not established.
A value gr e ate r than zero indicates an error, the value -1 the conne ct i on was closed
by the remote host, -2 indicates that the connection was not established within the
timeout period, and -3 i nd i cat e s that whe n polling the connection has not yet been
established.
Tcp
listen arg1: sock arg2: n
This causes the specified socket to be willi ng to accept incoming calls from remote
hosts. The queue limit for incoming connections is specified by n. A zero result indicates
success.
Tcp accept arg1: sock arg2: tcp, arg4: timeout
BEWARE: t he implementation does not yet quite match the following specification.
This attempts to accept a connection from a remote host via a listening socket within
a specified timeout pe ri od. If timeout is greater than zero it is the timeout period in
milli-seconds, if it is zero there is no timeout and if it is negative the packet is returned
immediately having accepted a connection if possible. A positive re sul t indicates success
and is the number of a new socket to to be used by the connection. A negative result
indicates failure with a reason in the second result. A s ec ond result of -1 indicates the
connection was closed by the remote host, -2 means a connection was not ac ce pt e d
within the timeout perio d, and -3 indicates that there is currently no connection to
accept when polling.
Tcp
recv arg1: sock arg2: buf arg3: len arg4: timeout
This attempts to read u p to len bytes into the given buffer from the specified socket
within a specified timeout period. If timeout is greater than zero it is the timeout
period in milli-seconds, if it is zero there is no timeout and if it is negative the packet
is return ed immediately with as many characters as are currently available. A negative
result indicates failure with a reason given in the sec ond r es ul t, otherwise it is the
number of bytes actually read.
Tcp
send arg1: sock arg2: buf arg3: len arg4: timeout
This attempts to send len bytes from the given buffer via the specified socket within