I’ve been trying to figure this out for a while now and I need help because I’m out of ideas. My WSAEventselect function returns error number 10038.
Code:
// Error checking....
if(netEvent.iErrorCode[FD_ACCEPT_BIT] != 0)
{
int temp1 = WSAGetLastError();
emit ClientErrorSignal();
return;
}
// Initializing socket
if((newClient = accept(this->info->socket, NULL, NULL)) == INVALID_SOCKET)
{
int temp2 = WSAGetLastError();
emit ClientErrorSignal();
return;
}
// This is where the error occurs
if(WSAEventSelect(newClient, &this->info->event, FD_READ|FD_CLOSE) == SOCKET_ERROR)
{
int temp3 = WSAGetLastError();
emit ClientErrorSignal();
return;
}
this->info is a struct that is passed into the thread.
typedef struct {
SOCKET socket;
int size;
bool isTcp;
WSAEVENT event;
} SINFO, *PSINFO;
According to the Winsock error reference, this is a
WSAENOTSOCKerror, meaning you’re trying to do something with an invalid socket handle. Without more information about where the error is occurring in your code I don’t think I can offer much more advice than that, but I’d suggest checking to ensure that you’re creating the socket correctly (perhaps the call toaccepton an uninitialized socket is the culprit?)