(libc.info.gz) Socket Option Functions
Info Catalog
(libc.info.gz) Socket Options
(libc.info.gz) Socket-Level Options
16.12.1 Socket Option Functions
-------------------------------
Here are the functions for examining and modifying socket options. They
are declared in 'sys/socket.h'.
-- Function: int getsockopt (int SOCKET, int LEVEL, int OPTNAME, void
*OPTVAL, socklen_t *OPTLEN-PTR)
Preliminary: | MT-Safe | AS-Safe | AC-Safe | POSIX Safety
Concepts.
The 'getsockopt' function gets information about the value of
option OPTNAME at level LEVEL for socket SOCKET.
The option value is stored in a buffer that OPTVAL points to.
Before the call, you should supply in '*OPTLEN-PTR' the size of
this buffer; on return, it contains the number of bytes of
information actually stored in the buffer.
Most options interpret the OPTVAL buffer as a single 'int' value.
The actual return value of 'getsockopt' is '0' on success and '-1'
on failure. The following 'errno' error conditions are defined:
'EBADF'
The SOCKET argument is not a valid file descriptor.
'ENOTSOCK'
The descriptor SOCKET is not a socket.
'ENOPROTOOPT'
The OPTNAME doesn't make sense for the given LEVEL.
-- Function: int setsockopt (int SOCKET, int LEVEL, int OPTNAME, const
void *OPTVAL, socklen_t OPTLEN)
Preliminary: | MT-Safe | AS-Safe | AC-Safe | POSIX Safety
Concepts.
This function is used to set the socket option OPTNAME at level
LEVEL for socket SOCKET. The value of the option is passed in the
buffer OPTVAL of size OPTLEN.
The return value and error codes for 'setsockopt' are the same as
for 'getsockopt'.
Info Catalog
(libc.info.gz) Socket Options
(libc.info.gz) Socket-Level Options
automatically generated by
info2html