<<UNIX Netwok programming>> 7.4
The following socket options are inherited by a connected TCP socket from the listening socket: SO_DEBUG,SO_DONTROUTE,SO_KEEPALIVE,SO_LINGER,SO_OOBINLINE,SO_RCVBUF,SO_RCVLOWAT,SO_SNDBUF,SO_SNDLOWAT,TCP_MAXSEG,TCP_NODELAY.This is importnat with TCP because the connected socket is not returned to a server by accept until the three-way handshake is completed by the TCP layer.To ensure that one of these socket options is set for the connected socket when the three-way handshake completes, we must set that option for the listening socket.
在UNIX系统上,这些socket option
SO_DEBUG, SO_DONTROUTE, SO_KEEPALIVE, SO_LINGER,SO_OOBINLINE, SO_RCVBUF, SO_RCVLOWAT, SO_SNDBUF, SO_SNDLOWAT, TCP_MAXSEG, TCP_NODELAY会被accept的fd从listen fd继承,因为三次握手在内核TCP协议栈,此时有些行为还来不及在应用层设置,所以需要从listen fd继承。
不同版本,不同操作系统行为可能不同,需要进一步测试。