VOID createServerSocket() { WSADATA wsa; //Initialise winsock// if (WSAStartup(MAKEWORD(2,2),&wsa) != 0) { //"WinSock Initialization FAILED", } //Create a socket// SOCKET newSocketIdentifier; SOCKADDR_IN newSocket; if((newSocketIdentifier = socket(AF_INET , SOCK_DGRAM , 0 )) == INVALID_SOCKET) { //Socket Creation Failed } //Socket Created// //Prepare the sockaddr_in structure// newSocket.sin_family = AF_INET; newSocket.sin_addr.s_addr = INADDR_ANY; newSocket.sin_port = htons(8888); //Bind// if( bind(newSocketIdentifier ,(struct sockaddr *)&newSocket, sizeof(SOCKADDR_IN)) == SOCKET_ERROR) { //Bind Failed } //Bind Done// WSAEVENT NewEvent = WSACreateEvent(); WSAEventSelect(newSocketIdentifier, NewEvent, FD_READ | FD_WRITE); //made the socket "newSocketIdentifier" event based for events "FD_READ" and FD_WRITE }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)