I’m creating a project using winsock2’s sockets
I’m using a syscall to connect to a socket on a local IP address, then I implemented a simple method for error handling purposes.
// Client-side
int LPTF_SOCKET::connectLPTFSocket()
{
if (connect(sockfd, (struct sockaddr *)&server, sizeof(server)) < 0)
{
std::cerr << "Connection failed: " << WSAGetLastError() << std::endl;
closesocket(sockfd);
WSACleanup();
return 1;
}
std::cerr << "connect returned success" << std::endl;
return 0;
}
However, whenever an error occurs, my project partners get the code 10047. It is fixed since then, but I always get error 0, which is weird since it doesn’t appear on the official documentation
The thing is, this error code appears on both of my computers, so that makes it even stranger.
I thought at first it might be due to the firewall, but I’m not sure. Do you guys have a clue of what’s going on? I can’t work on the project anymore
I tried to run the program server-side. It works perfectly, but not for the client-side.