Getting And Setting Socket Options - HP Rp3440-4 - 9000 - 0 MB RAM Programmer's Manual

Bsd sockets interface programmer’s guide
Hide thumbs Also See for Rp3440-4 - 9000 - 0 MB RAM:
Table of Contents

Advertisement

Advanced Topics for Stream Sockets
Socket Options
• SO_SNDTIMEO
• SO_RCVTIMEO
• SO_BROADCAST
• SO_REUSEPORT
In addition, the SO_DEBUG option is supported for compatibility only; it
has no functionality.
Options for protocol levels are described in the individual protocol
manual pages, such as tcp(7p), udp(7p), and ip(7p).
The next section describes how to get the current value of a socket option
and to set socket options, followed by a description of each available
option. Refer to chapter 6 for a description of the SO_BROADCAST
option.

Getting and Setting Socket Options

The socket options are defined in the sys/socket.h file. You can get
the current status of an option with the getsockopt call, and you can
set the value of an option with the setsockopt call.
getsockopt and its parameters are described in the following table:
Include files:
#include <sys/types.h>
#include <sys/socket.h>
System call:
getsockopt(s, level, optname, optval, optlen)
int s, level, optname;
char *optval;
int *optlen;
62
Chapter 3

Advertisement

Table of Contents
loading

Table of Contents