Socket Options

getsockopt()
setsockopt()
 
optval Returns the value 0 indicates option is turned off, an opening presentation option
 
SO_BROADCAST set of interface options:
Enable or disable the ability of the process to send broadcast messages. It sends broadcast information to prevent the application process is not completed design can broadcast.
 
SO_DEBUG set of interface options:
Kernel tracking details for all TCP packets transmitted and received on this socket.
 
SO_DONTROUTE set of interface options:
Issued predetermined packet routing mechanism bypass normal underlying protocol. For IPV4, packets directed local interface
 
SO_ERROR set of interface options:
When an error occurs on the socket, the kernel notification process in the following ways:
1 blocking process to select call, select go back and set up one or two of the conditions in which
Process 2 IO model using the drive signal is generated to the processes or process groups SIGIO
 
SO_KEEPALIVE set of interface options:
In order to detect the other host crashes
If you set the option alive, if no data exchange within two hours, then automatically sent to the other party a keep-alive probe section.
1 other desired ACK response, everything is normal
2 RST response to the other party, has told crash and reboot
3 If there has been no response, socket is closed
 
SO_LINGER set of interface options:
Specified function of how close the connection-oriented protocol.
 
TCP_KEEPALIVE set of interface options:
Specifies TCP keep-alive transmission preganglionic probe points to connect the idle time in units of seconds. The default is 7200 seconds
 
TCP_MAXRT set of interface options:
Once the specified TCP retransmit data, the amount of time required before disconnecting manager.
 
TCP_MAXSEG set of interface options:
Gets or sets the maximum section size MSS TCP connection
 
TCP_NODELAY set of interface options:
Prohibit the TCP Nagle algorithm
 
TCP_STDURG socket options
Affect the interpretation of TCP urgent pointer
 
fcntl ---- file control file control, various control operations descriptor.
 

Reproduced in: https: //my.oschina.net/u/204616/blog/545267

Guess you like

Origin blog.csdn.net/weixin_33813128/article/details/91989822