了解setgetsockopt SO_SNDBUF大小加倍

了解setgetsockopt SO_SNDBUF大小加倍,第1张

了解set / getsockopt SO_SNDBUF大小加倍

你没做错什么 在设置时,Linux将值加倍(在内核内),并在查询时返回加倍的值。

man 7 socket
说:

[...]    SO_SNDBUF   Sets or gets the maximum socket send buffer in bytes.  The  ker-   nel doubles this value (to allow space for bookkeeping overhead)   when it is set using setsockopt(), and  this  doubled  value  is   returned  by  getsockopt().   The  default  value  is set by the   wmem_default sysctl and the maximum allowed value is set by  the   wmem_max sysctl.  The minimum (doubled) value for this option is   2048.[...]NOTES       Linux assumes that half of the send/receive buffer is used for internal       kernel structures; thus the sysctls are twice what can be  observed  on       the wire.[...]


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4999831.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-14
下一篇 2022-11-14

发表评论

登录后才能评论

评论列表(0条)

保存