boost async_read_some/async_receive 的行为就像 MSG_PEEK 始终打开一样
我有以下问题。
我在 tcp 套接字上启动 async_receive。
使用一些数据调用回调
我在套接字上启动另一个异步接收。
回调被调用,但缓冲区还包含上次调用的数据。行为就像我用 MSG_PEEK 标志调用 recv 一样,尽管我没有这样做。
我什至尝试调用消息标志参数 = 0 的版本并具有相同的效果。
我怎样才能禁用这种行为?我希望在每次成功的异步处理程序调用后第一次调用可以吃掉内核缓冲区中的数据。
米哈伊
I have the following problem.
I start an async_receive on a tcp socket.
Callback is called with some data
I start another async receive on the socket.
Callback is called but the buffer also contains the data from the previous call. Behaves as if i called recv with MSG_PEEK flag, although i did no such thing.
I even tried to called the version with message flags argument = 0 and same effect.
How can i disable this behaviour?. I would like the first call to eat the data from the kernel buffers after each successfull async handler call.
Mihai
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经解决了这个问题。这是一个发送问题。我正在重用传递给 async_write 的缓冲区向量。
i've fixed the problem. It was a send problem. I was reusing the vector of buffers passed to async_write.