快速提问,想知道是否有人知道Windows下SO_RCVBUF的限制是什么。
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.
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 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.
根据这篇文章 ,看起来最大值是64K。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.