简体   繁体   English

在调试器中时 Winsock2 数据丢失

[英]Winsock2 data loss when in debugger

i am using Winsock2 in conjunction with overlapped I/O.我将 Winsock2 与重叠 I/O 结合使用。 This means i am calling WSARecv with a WSAOVERLAPPED structure and later i wait with WSAWaitForMultipleEvents for data.这意味着我用 WSAOVERLAPPED 结构调用 WSARecv,然后我用 WSAWaitForMultipleEvents 等待数据。

I made the strange observation that i seem to loose any data that is send to my application while i am halting it with the debugger.我做了一个奇怪的观察,当我用调试器停止它时,我似乎丢失了发送到我的应用程序的任何数据。 I thought this data would pile up somewhere in the OS and then be delivered on the next call to WSARecv.我认为这些数据会堆积在操作系统的某个地方,然后在下一次调用 WSARecv 时传递。

Is my assumption false?我的假设是错误的吗?

UDP or TCP? UDP 还是 TCP?

I assume you ARE using a separate OVERLAPPED structure per call and a separate event per structure.我假设您每次调用都使用一个单独的 OVERLAPPED 结构,每个结构使用一个单独的事件。

Bear in mind that it's not especially scalable to use the overlapped I/O with events, it's much easier to simply associate the socket with an I/O Completion Port and skip the whole event thing completely.请记住,将重叠 I/O 与事件一起使用并不是特别可扩展,只需将套接字与 I/O 完成端口相关联并完全跳过整个事件事情就容易得多。

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

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