TCP/IP Programming Manual

getsockopt, getsockopt_nw
The getsockopt and getsockopt_nw functions return the socket options for a socket.
C Synopsis
#include <socket.h>
#include <in.h>
#include <in6.h> /* for IPv6 use */
#include <netdb.h>
error = getsockopt (socket, level, optname, optval_ptr,
optlen_ptr);
error = getsockopt_nw (socket, level, optname, optval_ptr,
optlen_ptr, tag);
int error, socket, level, optname;
char *optval_ptr;
int *optlen_ptr;
long tag;
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
error := getsockopt (socket, level, optname, optval_ptr,
optlen_ptr);
error := getsockopt_nw (socket, level, optname, optval_ptr,
optlen_ptr, tag);
INT(32) error;
INT(32) socket,
level,
optname;
STRING .EXT optval_ptr;
INT .EXT optlen_ptr;
INT(32) tag;
error
return value; f the call is successful, a zero is returned. If the call is not successful, —1 is returned.
If the call failed, the external variable errno is set as indicated in Errors (page 130).
socket
input value; specifies the socket number for the socket, as returned by the call to socket or
socket_nw.
level
input value; the socket level at which the socket option is being managed. The possible values
are:
Socket-level option.SOL_SOCKET
TCP-level option.IPPROTO_TCP
IP-level option.IPPROTO_IP
ICMP-level option.IPPROTO_ICMP
UDP-level option.IPPROTO_UDP
Raw-socket level option.IPPROTO_RAW
Option for a user-defined protocol above IP, such as PUP.user-protocol
128 Library Routines