mercredi 4 mars 2015

How to initialize WSAOVERLAPPED when using IOCP?


I am not sure how to initialize WSAOVERLAPPED when using IOCP. I don't think that I need to initialize it at all, I only set WSAOVERLAPPED.hEvent to NULL (not sure if this is necessary either). Is this code correct:



// Send data
char buffer[1024];

WSABUF wsaBuf;
wsaBuf.buf = buffer;
wsaBuf.len = 1024;

WSAOVERLAPPED wsaOverlapped;
wsaOverlapped.hEvent = NULL;

WSASend(s, &wsaBuf, 1, NULL, 0, &wsaOverlapped, NULL);


Also, is initializing OVERLAPPED when using WSARecv() the same as initializing WSAOVERLAPPED?




Aucun commentaire:

Enregistrer un commentaire