Windows 中 SO_RCVBUF 的最大值?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/565804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
max value for SO_RCVBUF in Windows?
提问by PiNoYBoY82
Quick question, wondering if anyone knew what the limit is for SO_RCVBUF under Windows.
快速提问,想知道是否有人知道 Windows 下 SO_RCVBUF 的限制是多少。
采纳答案by a_mole
SO_RCVBUF in winsock is not limited by the TCP window size. At least for pre-Vista stacks. It would be limited by non-paged pool availability, which is a whole different topic. So you can make it quite big, if you want to.
winsock 中的 SO_RCVBUF 不受 TCP 窗口大小的限制。至少对于Vista 之前的堆栈。它将受到非分页池可用性的限制,这是一个完全不同的主题。所以你可以把它做得很大,如果你愿意的话。
Obligatory unsolicited advice: If you are using a large buffer because you are receiving infrequently, I would look into asynchronous I/O with events/select/completion ports.
强制性的主动建议:如果您因为接收频率低而使用大缓冲区,我会研究带有事件/选择/完成端口的异步 I/O。
回答by dwc
I can't recall for sure, but I believe Windows supports the POSIX function fpathconf()
with the _PC_SOCK_MAXBUF
option. If so, this is exactly what you're looking for.
我不记得了,但我相信 Windows 支持fpathconf()
带有该_PC_SOCK_MAXBUF
选项的 POSIX 功能。如果是这样,这正是您要寻找的。
回答by Michael Kristofik
Based on this article, it looks like the maximum is 64K.
根据这篇文章,看起来最大值是 64K。