What is setsockopt




















Allows the socket to be bound to an address that is already in use. For more information, see bind. Not applicable on ATM sockets. This object stores the configuration information for the service provider associated with socket s. The exact format of this data structure is service provider specific. Disables the Nagle algorithm for send coalescing. This socket option is included for backward compatibility with Windows Sockets 1.

Indicates broadcast packets are likely on the socket. Set to TRUE by default. Applications without back-and-forth traffic should set this to TRUE to increase performance. Returns whether a socket is in listening mode. This option is only Valid for connection-oriented protocols.

This socket option is not supported for the setting. This option sets the minimum number of bytes to process for socket input operations. This option sets the minimum number of bytes to process for socket output operations.

This option takes an int value in the optval argument. This is a BOOL option. Permits sending of broadcast messages, if this is supported by the protocol. Specifies that the rules used in validating addresses supplied to bind should allow reuse of local addresses, if this is supported by the protocol.

Keeps connections active by enabling periodic transmission of messages, if this is supported by the protocol. Specifies whether the socket lingers on close if data is present.

This option takes a linger structure in the optval argument. If no option value is to be supplied or returned, optval may be NULL. Optname and any specified options are passed uninterpreted to the appropriate protocol module for interpretation. Options at other protocol levels vary in format and name; consult the appropriate entries in section 4 of the manual.

Most socket-level options utilize an int parameter for optval. For setsockopt , the parameter should be non-zero to enable a boolean option, or zero if the option is to be disabled. For a description of the available socket options see socket 7 and the appropriate protocol man pages. Viewed 30k times.

Improve this question. Google: cs. For setting the documented socket options. The answer to this question should be looked for in specifications and manuals, not a forum.

Add a comment. Active Oldest Votes. Improve this answer. Sanja Melnichuk Sanja Melnichuk 3, 3 3 gold badges 24 24 silver badges 46 46 bronze badges. For reusing address setsockopt is used. But where this function should be used?



0コメント

  • 1000 / 1000