*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: setsockopt | Section: 2 | Source: Digital UNIX | File: setsockopt.2.gz
setsockopt(2) System Calls Manual setsockopt(2) NAME setsockopt - Sets socket options SYNOPSIS #include <sys/socket.h> int setsockopt ( int socket, int level, int option_name, const void *option_value, size_t option_len ); [Digital] The following definition of the setsockopt() function does not conform to current standards and is supported only for backward compatibility (see standards(5)): #include <sys/socket.h> int setsockopt ( int socket, int level, int option_name, char *option_value, int option_len ); STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: setsockopt(): XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. PARAMETERS Specifies the unique socket name. Specifies the protocol level at which the option resides. To set options at the socket level, specify the level parameter as SOL_SOCKET. To set options at other levels, supply the appropriate protocol number for the protocol controlling the option. For example, to indicate that an option will be interpreted by the TCP protocol, set level to the protocol number of TCP, as defined in the netinet/in.h file or as determined by using the getprotobyname() function. Specifies the option to set. The option_name parameter and any specified options are passed uninterpreted to the appropriate pro- tocol module for interpretation. The sys/socket.h header file defines the socket level options. The socket level options can be enabled or disabled. The options are: Turns on recording of debugging informa- tion. This option enables or disables debugging in the underlying protocol modules. This option takes an int value. Permits sending of broadcast messages. This option takes an int value. Specifies that the rules used in validating addresses supplied by a bind() function should allow reuse of local addresses. This option takes an int value. Keeps connections active. Enables the periodic transmission of mes- sages on a connected socket. If the connected socket fails to respond to these messages, the connection is broken and processes using that socket are notified with a SIGPIPE signal. [Digital] Indicates that outgoing messages should bypass the standard routing facilities. In- stead, they are directed to the appropriate network interface according to the network portion of the destination address. [Digital] Valid only for routing sockets. Determines if a sending socket receives a copy of its own message. Lingers on a close() function if data is present. This option controls the action taken when unsent messages queue on a socket and a close() function is performed. If SO_LINGER is set, the system blocks the process during the close() function until it can transmit the data or until the time expires. If SO_LINGER is not specified and a close() function is issued, the system handles the call in a way that allows the process to continue as quickly as possible. This option takes a struct linger value, defined in the sys/socket.h header file, to specify the state of the option and linger interval. Leaves received out-of-band data (data marked urgent) in line. This option takes an int value. Sets send buffer size. This option takes an int value. Sets receive buffer size. This option takes an int value. [Digital] Sets send low-water mark. This option takes an int value. [Digital] Sets receive low-water mark. This option takes an int value. [Digital] Sets send time out. This option takes a struct timeval value, defined in the sys/time.h header file, to specify the timeout interval. [Digital] Sets receive time out. This option takes a struct timeval value, defined in the sys/time.h header file, to spec- ify the timeout interval. [Digital] Allows more than one process to receive UDP datagrams destined for the same port. The bind system call binding a process to that port must be preceded by a setsockopt system call specifying this option. [Digital] Options at other protocol levels vary in format and name. See the tcp(7) and ip(7) reference pages for more infor- mation on option names relevant for TCP and IP options respec- tively. Note [Digital] The maximum values for socket level options like SO_SENDBUF, SO_RCVBUF, SO_SNDLOWAT, and SO_RCVLOWAT are governed by the protocol limits, as well as its implementation. Use the getsockopt(2) routine to verify the values for these options af- ter the socket connection has been established. To enable a Boolean option or integer value, set the op- tion_value parameter to a nonzero value. To disable an option, set the option_value parameter to 0 (zero). The option_len pa- rameter contains the size of the buffer pointed to by the op- tion_value parameter. DESCRIPTION The setsockopt() function sets options associated with a socket. Op- tions may exist at multiple protocol levels. The SO_ options are al- ways present at the uppermost socket level. The setsockopt() function provides an application program with the means to control a socket communication. An application program can use the setsockopt() function to enable debugging at the protocol level, allocate buffer space, control timeouts, or permit socket data broadcasts. The sys/socket.h file defines all the options available to the setsockopt() function. When setting socket options, specify the protocol level at which the option resides and the name of the option. Use the option_value and option_len parameters to access option values for the setsockopt() function. These parameters identify a buffer in which the value for the requested option or options is returned. RETURN VALUES Upon successful completion, a value of 0 (zero) is returned. Other- wise, a value of -1 is returned and errno is set to indicate the error. ERRORS If the setsockopt() function fails, errno may be set to one of the fol- lowing values: The socket parameter is not valid. The option_len para- meter is not valid. The option_value parameter is not in a readable part of the user address space. The option is unknown. The socket pa- rameter refers to a file, not a socket. RELATED INFORMATION Functions: bind(2), endprotoent(3), getsockopt(2), getprotobynumber(3), getprotoent(3), setprotoent(3), socket(2) Network Information: ip(7), tcp(7) Standards: standards(5) delim off setsockopt(2)

Navigation Options