read_some/write_some 和 receive/send 之间的区别?
我开始使用 Boost Asio 的 TCP 套接字。 read_some
< 之间有什么区别/a> 和 接收
是什么write_some
和 发送
?谢谢!
I am beginning to work with Boost Asio's TCP sockets. What is the difference between read_some
and receive
and what is the difference between write_some
and send
? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据我记得,read_some和receive实际上在做同样的事情。我认为 receive 只是调用 read_some ,反之亦然。一个命名来自将套接字视为文件(读/写)的想法,而另一个命名则来自于连接(发送/接收)点看法。 write_some 和 send 也应该如此。
As far as I remember, read_some and receive are actually doing the same. I think receive just calls read_some or vice versa. The one naming comes from the idea of treating a socket as a file (read/write), while the other one rather comes from a connection(send /receive) point of view. Same should be true for write_some and send.
在 BOOST ASIO 文档中, TCP 客户端部分说:
In BOOST ASIO documentation, section TCP Clients says:
相同。 调用 this->get_service().send()
两者都从 basic_stream_socket.hpp
the same. both call this->get_service().send()
from basic_stream_socket.hpp