C++ Windows Asynch IO Named Pipe first message not received

旧城冷巷雨未停 提交于 2019-12-01 14:40:28

In the server's read loop, you are discarding any data that arrives asynchronously.

After GetOverlappedResult() has reported that the pending I/O operation is complete, the buffer contains the data from that operation. You're ignoring that data and issuing a new read operation into the same buffer.

The only reason you get any of the messages is that (on most runs) all four messages will be written into the pipe's internal buffer at the same time. The first message arrives asynchronously, so you miss it, but the remaining three messages are already in the pipe so those reads can complete immediately.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!