socket 函数 setsockopt()用法

资料来源: 微软MSDN在线帮助

setsockopt(s, level, optname, optval, optlen) 函数
https://msdn.microsoft.com/library/windows/desktop/ms740476.aspx

level = SOL_SOCKET

optname编码TypeDescription
SO_BROADCASTBOOLConfigures a socket for sending broadcast data.
SO_CONDITIONAL_ACCEPTBOOLEnables incoming connections are to be accepted or rejected by the application, not by the protocol stack.
SO_DEBUGBOOLEnables debug output. Microsoft providers currently do not output any debug information.
SO_DONTLINGERBOOLDoes 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_DONTROUTEBOOLSets 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_PRIORITYintReserved.
SO_KEEPALIVEBOOLEnables sending keep-alive packets for a socket connection. Not supported on ATM sockets (results in an error).
SO_LINGERLINGERLingers on close if unsent data is present.
SO_OOBINLINEBOOLIndicates 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_RCVBUFintSpecifies the total per-socket buffer space reserved for receives.
SO_REUSEADDRBOOLAllows the socket to be bound to an address that is already in use. For more information, see bind. Not applicable on ATM sockets.
SO_EXCLUSIVEADDRUSEBOOLEnables a socket to be bound for exclusive access. Does not require administrative privilege.
SO_RCVTIMEODWORDSets the timeout, in milliseconds, for blocking receive calls.
SO_SNDBUFintSpecifies the total per-socket buffer space reserved for sends.
SO_SNDTIMEODWORDThe timeout, in milliseconds, for blocking send calls.
SO_UPDATE_ACCEPT_CONTEXTintUpdates the accepting socket with the context of the listening socket.
PVD_CONFIGService Provider DependentThis object stores the configuration information for the service provider associated with socket s. The exact format of this data structure is service provider specific.

详细参数

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值