User`s guide

KwikNet TCP/IP Sockets
K
A
DAK
187
5.3 Socket Options
The operation of sockets is controlled by socket level options. Options are always
present at the socket level identified as SOL_SOCKET. KwikNet also supports TCP options
at protocol level IPPROTO_TCP. There are no UDP protocol options. The KwikNet options
are listed in file KN_SOCK.H but are defined in Treck file TRSOCKET.H. Procedures
kn_getsockopt() and kn_setsockopt() are used to access and modify these options.
The following commonly used options are recognized by
KwikNet. Options marked R can
be read using
kn_getsockopt(). Options marked W can be modified using
kn_setsockopt(). Unmarked options will return an error indication if referenced. The
options marked with > are non-standard extensions offered only by KwikNet.
In addition to these commonly used options, a number of other socket, TCP and IP
options are provided by Treck to adjust various operating characteristics. Refer to the
Treck TCP/IP User Manual and to Treck file TRSOCKET.H for details.
Option type UDP TCP Purpose
SO_REUSEADDR bool RW RW Local address reuse
SO_ACCEPTCONN bool R Check if socket is a listening socket
SO_KEEPALIVE bool RW Keep connections alive
SO_DONTROUTE bool Routing bypass for outgoing messages
SO_BROADCAST bool RW Permission to transmit broadcast messages
SO_OOBINLINE bool RW Allow out-of-band data in band
SO_LINGER struct RW Linger on close if data present
SO_SNDBUF u/s long RW Buffer size for send
SO_RCVBUF u/s long RW Buffer size for receive
SO_SNDLOWAT u/s long RW Buffer low limit for send
SO_RCVLOWAT u/s long RW Buffer low limit for receive
SO_SNDTIMEO struct Timeout limit for send
SO_RCVTIMEO struct Timeout limit for receive
SO_ERROR int RR Get and clear error on a socket
SO_NONBLOCK bool RW RW > Socket operates in non-blocking mode
TCP_NODELAY bool RW Do not delay data send to coalesce data
TCP_NOPUSH bool RW Do not push last byte of data sent
TCP_MAXSEG int RW Get maximum segment size (MSS)
Option
SO_REUSEADDR indicates that the rules used in validating addresses supplied in a
kn_bind() call should allow reuse of local addresses.
Option SO_ACCEPTCONN can be used to determine if a socket is a listening socket, a socket
which accepts requests for connection.
Option SO_KEEPALIVE enables the periodic transmission of messages on a connected
socket. Should the connected party fail to respond to these messages, the connection is
considered broken. A process attempting to read from or write to the socket receives an
error indication.
Option SO_DONTROUTE indicates that outgoing messages should bypass the standard
routing facilities.
KwikNet does not support this option.