I am not sure what the WSAData function does and was hoping someonce can explain it or suggest any books or websites that can help. I am trying to make a server/client program.
It's almost impossible to know what that function does without seeing it, as a function can be named anything. But, if I had to guess, based on the name alone, I would say it's a function to move something on screen, based on the letters, 'w' for up, 's' for down, 'a' for left and, lastly, 'd' for right. Of course, this IS JUST a guess. Someone could give a better interpretation if we could see a copy of said function you're referring to.
This is what i meant. I have a small understanding on this code, but i wanted someone to help explain this better. I am still pretty new to C++ and i want to move toward the networking side. I thought that this is a good place to start.
#include<iostream>
#include<Windows.h>
#include<stdio.h>
#pragma comment(lib,"ws2_32.lib")
usingnamespace std;
SOCKET sock; // this is the socket that we will use
SOCKET sock2[200]; // this is the sockets that will be recived from the Clients and sended to them
SOCKADDR_IN i_sock2; // this will contain information about the clients connected to the server
SOCKADDR_IN i_sock; // this will containt some informations about our socket
WSADATA Data; // this is to save our socket version
int clients = 0; // we will use it in the accepting clients
int server(int port)
{
int err;
WSAStartup(MAKEWORD(2, 2), &Data);
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == INVALID_SOCKET) {
Sleep(4000);
exit(0);
}
}