I have quite an embarrassing problem. The following code simply will not create a socket on Windows; it fails and displays the error message. Could anyone briefly explain why th
An Example:
#include
#include
#pragma comment(lib,"ws2_32.lib")
int _cdecl main(){
WSADATA Data;
int socket; // or you can use SOCKET socket
WSAStartup(MAKEWORD(2, 2), &Data); // 2.2 version
socket = socket(AF_INET, SOCK_DGRAM, 0);
if(udep_socket<0){
printf("Error Creating Socket");
}else{
printf("Successfully Created Socket");
}
system("pause");
return 0;
}