Im trying to create a program using Windows sockets and i am getting an error code 0 when trying to create the socket
int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (iResult != NO_ERROR) {
wprintf(L"WSAStartup function failed with error: %d\n", iResult);
}
csocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if(csocket != INVALID_SOCKET){
wprintf(L"socket function failed with error: %ld\n", WSAGetLastError());
}
The part that is failing is creating the socket and the output i am getting is "socket function failed with error: 0.
Thanks for the help in advance.