PDA

View Full Version : [C++] Winsock2


Teo@Unix
03-08-2009, 23:44
Ciao,
allora sono alle prese con la funzione WSARecv(),

il problema è che questa mi ritorna con errore "997" ovvero: (riporto spiegazione di MSDN)

"Overlapped operations will complete later.

The application has initiated an overlapped operation that cannot be completed immediately. A completion indication will be given later when the operation has been completed. Note that this error is returned by the operating system, so the error number may change in future releases of Windows."

Il mio non è un socket overlapped (che non sono ancora andato a vedere di cosa si tratta), riporto qui l'ordine delle mie operazioni:

SOCKET sock;
WSADATA wsadata;
WSAStartup(MAKEWORD(2,2), &wsadata);
WSABUF DataBuf;
DataBuf.len = MAX;
DataBuf.buf = rx;
DWORD lpNumberOfBytesRecvd;
DWORD TotalBytesRecvd = 0;
DWORD lpFlags = 0;
WSAOVERLAPPED RecvOverLapped = {0};

/* O perlomeno così ho tentato di settare la recv */

WSARecv(sock, &DataBuf, 1, &lpNumberOfBytesRecvd, &lpFlags, &RecvOverLapped, 0);

Mi sapete aiutare?? Per esempio il valore che ho settato di lpflag è corretto?