AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database

Socket_Setsockopt - setsockopt()

In:     R0 = Socket descriptor
     R1 = Option level
     R2 = Option
     R3 = Pointer to option value
     R4 = Size of option value

Out:     R0 corrupted

This is used to set a particular option on a socket. The level is either SOL_SOCKET for options applicable to all sockets, or a protocol number for options applicable to a certain protocol. Currently supported socket level options are:

SO_REUSEADDR - Enables or disables the reuse of local addresses during the wait period that normally occurs when a TCP stream socket is closed. The argument is a single word which contains zero to disable this option, or a non-zero value to enable it.

SO_KEEPALIVE - Enable or disable attempts to probe the remote end of a TCP connection when the link has been idle for some time.

SO_BROADCAST - Enable or disable sending of broadcast packets through this socket.

SO_LINGER - Control whether the socket lingers on close. The argument points to two words, the first of which is a boolean that indicates wether the socket waits for data to drain when it is closed, and the second is the length of time to wait in seconds.

SO_OOBINLINE - Control whether OOB data is received inline with the normal data, or out of line as a separate data stream.

SO_SNDBUF - Set the size of the send buffer to the value given by the argument, which is a single word.

SO_RCVBUF - Set the size of the receive buffer to the value given by the argument, which is a single word.

SO_SNDLOWAT - Set the low water mark of the send buffer. The stack will block a send until there is this much space in the send buffer before it starts to send the data.

SO_RCVLOWAT - Set the low water mark of the receive buffer. The stack will always try and return at least this many bytes on a read, blocking if necessary.

SO_SNDTIMEO - Set the send timeout. This is the maximum length of time that a send call will block for before returning. The argument is a pointer to a timeout block as described under Socket_Select.

SO_RCVTIMEO - Set the receive timeout. This is the maximum length of time that a receive call will block for before returning. The argument is a pointer to a timeout block as described under Socket_Select.

The IP protocol also supports several options:

IP_OPTIONS - Set some IP options which will be added to each packet sent on a socket.

IP_HDRINCL - This toggles whether data sent on a socket already has an IP header included or not. This should only ever be set on raw sockets.

IP_TOS - Set the type of service field in packets sent using this socket to the specified value.

IP_TTL - Set the time to live field in packets sent using this socket to the specified value.

Finally, there are a number of options supported by the TCP protocol:

TCP_NODELAY - Disable the Nagle algorithm for this connection, to ensure that data is always sent immediately.

TCP_MAXSEG - Set the maximum segment size to use for data sent on this connection.


[sh-index] Back to list of manuals