So I started out with some basic socket programming, first on VC++ 9.0 but it gave me the same error as I got on Cygwin, apparently it's some 'linker error' but I really have no idea how to address that issue, apparently there are some dependencies called ws2_32.dll and ws2_32.lib that needs to be linked for the socket program to work properly. The error I get is:
undefined reference to WSAStartup
undefined reference to WSACleanup
Code:
//#include "stdafx.h"
#include <windows.h>
#include <winsock.h>
#include <stdio.h>
int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WSADATA ws;
char buf[1000], buf1[100], buf2[100], buf3[100], buf4[100], buf5[100], buf6[100];
WSAStartup (0x0101, &ws);
buf[0] = "";
sprintf(buf1,"\nWinsock Ver Requested : %d.%d", HIBYTE(ws.wVersion), LOBYTE(ws.wVersion));
sprintf(buf2,"\nWinsock Ver Available : %d.%d", HIBYTE(ws.wHighVersion), LOBYTE(ws.wHighVersion));
sprintf(buf3,"\nCurrent WinSock Implementation: %s", &ws.szDescription);
sprintf(buf4,"\nSystem Status : %s", &ws.szSystemStatus);
sprintf(buf5,"\nMaximum Sockets : %u", ws.iMaxSockets);
sprintf(buf6,"\nMaximum Message Size : %u", ws.iMaxUdpDg);
strcat(strcat(strcat(strcat(strcat(strcat(buf,buf1),buf2),buf3),buf4),buf5),buf6);
MessageBox(0,buf,"Info",0);
WSACleanup();
return 0;
}