Sto usando la funzione ioctlsocket() per rendere il mio socket non bloccante ma quando chiamo recvfrom(), ottengo l'errore 10035 (WSAEWOULDBLOCK
).recvfrom() errore 10035 utilizzando socket non bloccanti
u_long mode = 1;
ioctlsocket(newSocketIdentifier, FIONBIO, &mode);
while(1)
{
if((recv_len = recvfrom(newSocketIdentifier, receiveBuffer, sizeof(receiveBuffer), 0, (struct sockaddr *) &clientSocket, &clientSocketLength)) == SOCKET_ERROR)
{
char err[128];
itoa(WSAGetLastError(),err,10);
MessageBox(NULL,"Could not Receive Data",err,MB_ICONINFORMATION);
BREAK;
}
}
Qualcuno può spiegare perché questo accade? :(
Le chiamate I/O possono fallire. * Sei sicuro che * riesci * come rendendo il socket non bloccante? – unwind
Ottieni WSAEWOULDBLOCK su un socket non bloccante se al momento non ci sono dati disponibili.Questo è un comportamento normale –