WSAData HELP

May 8, 2016 at 3:26am
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.
May 8, 2016 at 4:08am
@fivestar

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.
May 8, 2016 at 7:04pm
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.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include<iostream>
#include<Windows.h>
#include<stdio.h>
#pragma comment(lib,"ws2_32.lib")
using namespace 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);

	}
}
Topic archived. No new replies allowed.