I am trying to make a client/server homework. I use Visual Studio 2017 and already changed the project settings that i can use sockets (Windows Socket Programming in C) but now my console always says "ERROR while creating Socket ... : No error"
This is my current code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <WinSock.h>
void PrintErrorExit(char *msg)
{
perror(msg);
exit(0);
}
int main()
{
int randomNumber;
int sock = 0;
// Erzeuge das Socket - Verbindung über TCP/IP
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0)
PrintErrorExit("ERROR while creating Socket ... ");
}