Download pSOSystem System Calls

Transcript
psc.book Page 19 Monday, January 11, 1999 1:50 PM
pSOSystem System Calls
getsockopt
#include <pna.h>
long getsockopt(
int s,
/*
int level,
/*
/*
int optname, /*
char *optval,/*
int *optlen /*
)
pNA+ System Calls
Gets options on a socket.
socket descriptor */
SOL_SOCKET, IPPROTO_IP, */
or IPPROTO_TCP */
retrieval option */
return buffer */
input/output buffer size */
Description
6
The getsockopt() system call obtains the status of options associated with the
specified socket. Socket level, IP protocol level, or TCP protocol level options may be
retrieved.
Arguments
getsockopt
s
Specifies the socket.
level
Specifies the level of the option to be queried and must be set to
SOL_SOCKET for socket level operations, IPPROTO_IP for IP
protocol level operations, or IPPROTO_TCP for TCP protocol
level operations.
optname
Specifies the option to be queried, and uses a symbolic constant.
The symbolic constants available for each level are provided
below and in <pna.h>.
optval
Points to a buffer where getsockopt() stores the value for the
requested option. For most options, an int is returned in the
buffer pointed to by optval. A nonzero value means the option
is set, and a 0 means the option is off.
optlen
An input-output parameter. On input, it should contain the size
of the buffer pointed to by optval. On output, it contains the
actual size of the value returned in the optval buffer.
6-19