yangyanzhao
2017-07-14 12:21
采纳率: 87.5%
浏览 1.0k

WSASend无法结束的问题

DataBuf.len = length;
DataBuf.buf = strBuff;
pIoContext->m_Overlapped.hEvent = WSACreateEvent();
result = WSASend(socket, &DataBuf,1, &SendBytes, 0, &pIoContext->m_Overlapped, NULL);
DWORD a = GetLastError();

result = WSAWaitForMultipleEvents(1, &pIoContext->m_Overlapped.hEvent, TRUE, INFINITE, TRUE);
if (result == WSA_WAIT_FAILED) {
    a = GetLastError();
    fprintf(stderr, "WSAWaitForMultipleEvents failed: %d\n", WSAGetLastError()); 
    //break;
}
result = WSAGetOverlappedResult(pIoContext->m_sockAccept, &pIoContext->m_Overlapped, &SendBytes, FALSE, &Flags);
if (result == FALSE) {
    a = GetLastError();
    fprintf(stderr, "WSASend operation failed: %d\n", WSAGetLastError()); 
    //break;
}
//printf("Wrote %d bytes\n", SendBytes);
WSAResetEvent(pIoContext->m_Overlapped.hEvent);
WSASend一直在被触发,停不下来,不知道为什么
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dabocaiqq 2018-07-30 16:17
    打赏 评论

相关推荐 更多相似问题