资料来源: 微软MSDN在线帮助
setsockopt(s, level, optname, optval, optlen) 函数
https://msdn.microsoft.com/library/windows/desktop/ms740476.aspx
level = SOL_SOCKET
optname编码 | Type | Description |
---|---|---|
SO_BROADCAST | BOOL | Configures a socket for sending broadcast data. |
SO_CONDITIONAL_ACCEPT | BOOL | Enables incoming connections are to be accepted or rejected by the application, not by the protocol stack. |
SO_DEBUG | BOOL | Enables debug output. Microsoft providers currently do not output any debug information. |
SO_DONTLINGER | BOOL | Does not block close waiting for unsent data to be sent. Setting this option is equivalent to setting SO_LINGER with l_onoff set to zero. |
SO_DONTROUTE | BOOL | Sets whether outgoing data should be sent on interface the socket is bound to and not a routed on some other interface. This option is not supported on ATM sockets (results in an error). |
SO_GROUP_PRIORITY | int | Reserved. |
SO_KEEPALIVE | BOOL | Enables sending keep-alive packets for a socket connection. Not supported on ATM sockets (results in an error). |
SO_LINGER | LINGER | Lingers on close if unsent data is present. |
SO_OOBINLINE | BOOL | Indicates that out-of-bound data should be returned in-line with regular data. This option is only valid for connection-oriented protocols that support out-of-band data. For a discussion of this topic, see Protocol Independent Out-Of-band Data. |
SO_RCVBUF | int | Specifies the total per-socket buffer space reserved for receives. |
SO_REUSEADDR | BOOL | Allows the socket to be bound to an address that is already in use. For more information, see bind. Not applicable on ATM sockets. |
SO_EXCLUSIVEADDRUSE | BOOL | Enables a socket to be bound for exclusive access. Does not require administrative privilege. |
SO_RCVTIMEO | DWORD | Sets the timeout, in milliseconds, for blocking receive calls. |
SO_SNDBUF | int | Specifies the total per-socket buffer space reserved for sends. |
SO_SNDTIMEO | DWORD | The timeout, in milliseconds, for blocking send calls. |
SO_UPDATE_ACCEPT_CONTEXT | int | Updates the accepting socket with the context of the listening socket. |
PVD_CONFIG | Service Provider Dependent | 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. |