HP-UX Reference (11i v1 05/09) - 2 System Calls (vol 5)

g
getsockopt(2) getsockopt(2)
NAME
getsockopt(), setsockopt() - get and set options on sockets
SYNOPSIS
#include <sys/socket.h>
int getsockopt(
int s,
int level,
int optname,
void *optval,
int *optlen
);
int setsockopt(
int s,
int level,
int optname,
const void *optval,
int optlen
);
_XOPEN_SOURCE_EXTENDED Only (UNIX 98)
int getsockopt(
int s,
int level,
int optname,
void *optval,
socklen_t *optlen
);
int setsockopt(
int s,
int level,
int optname,
const void *optval,
socklen_t optlen
);
Obsolescent _XOPEN_SOURCE_EXTENDED Only (UNIX 95)
int getsockopt(
int s,
int level,
int optname,
void *optval,
size_t *optlen
);
int setsockopt(
int s,
int level,
int optname,
const void *optval,
size_t optlen
);
DESCRIPTION
The getsockopt() and setsockopt() system calls manipulate options associated with a socket.
The socket is identified by the socket descriptor s. Options can exist at multiple protocol levels, and they
are always present at the uppermost "socket" level (see socket(2)).
When manipulating socket options, the level at which the option resides (level) and the name of the option
(optname) must be specified. To manipulate options at the "socket" level, level is specified as
SOL_SOCKET . To specify options at another level, level should be the protocol number specified in
<netinet/in.h > (for example, IPPROTO_TCP ).
Section 2116 Hewlett-Packard Company 1 HP-UX 11i Version 1: September 2005