简体   繁体   English

C ++:boost :: asio:可用于TCP套接字的最大缓冲区大小是多少?

[英]C++: boost::asio : what's the maximum buffer size I can use for TCP sockets?

In this SSL client example , the default buffer size is 1K=1024 bytes. 在此SSL客户端示例中 ,默认缓冲区大小为1K = 1024字节。 Are there any practical limitations on how much I could increase that? 我可以增加多少金额有实际限制吗? Would it work fine with no unforeseeable problems if I set the buffer to something like 100 MB? 如果将缓冲区设置为100 MB之类的话,是否可以正常工作而不会出现无法预料的问题?

Notice that the buffer is not just the reserved size; 注意,缓冲区不仅仅是保留的大小; it is also passed to read() and write() . 它也传递给read()write() At what size would these functions face problems due to size limitations? 由于尺寸限制,这些功能将面临多少尺寸的问题? Does such a limitation exist? 是否存在这样的限制? I can imagine that there is at least a defined limit for how much I can write() . 我可以想象,至少可以write()数量是有限制的。

除了int的最大值外没有其他限制,但是大于套接字接收缓冲区的读取缓冲区是没有意义的,因为多余的缓冲区永远无法使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM