accpet() Rturns 10014 Error! Weird One.

I ported my code from linux to windows. I get weird error about 10014 refering to accept() error...The error lies around here:
1
2
3
4
5
6
struct sockaddr clientInfo; //obtains clients information once accept() succeed
int clientInfo_size;  //holds the size of cleintInfo

//get the size of sockaddr struct of clientAddr
clientInfo_size = sizeof clientInfo;

1
2
3
4
5
6
7
8
9
10
11
	//accept pending connection. Information of incoming connection will go to clientInfo
clientSockD = accept(serverSockD, &clientInfo, &clientInfo_size);

if(clientSockD == INVALID_SOCKET )
{
	cout<<"ERROR: "<<WSAGetLastError()<<endl;
	closesocket(clientSockD);
	closesocket(serverSockD);
	WSACleanup();
	return 5;
}


Output:
1
2
3
Choose a port to listen on: 32324
waiting for a connection ...
ERROR: 10014
Last edited on
I'm pretty sure you use sizeof(clientInfo);
Also there is no reason to assign the sizeof to a variable since it is a constant.
I just had to make clientInfo as struct sockaddr_storage .....
Topic archived. No new replies allowed.