Hey guys, all a big thanks, I finally make it work. Here is the ugly horrible basic 1 time log code lol. I will work on it tommorrow, but at least it work -.-.
PHP Code:
#pragma once
#pragma comment(lib, "Ws2_32.lib")
#include <WinSock2.h>
#include <Windows.h>
#include <iostream>
using namespace std;
int main()
{
WSAData wsaData;
WORD DllVersion = MAKEWORD(2,2);
int startup_RetVal = WSAStartup(DllVersion, &wsaData);
SOCKET sSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
SOCKADDR_IN addr;
addr.sin_addr.s_addr = INADDR_ANY;
addr.sin_family = AF_INET;
addr.sin_port = htons(2222);
int iResult = bind(sSocket, (SOCKADDR*)&addr, sizeof(addr));
if (iResult == SOCKET_ERROR) {
wprintf(L"bind failed with error %u\n", WSAGetLastError());
closesocket(sSocket);
WSACleanup();
}
else
{
cout << "binded :)" << endl;
char buf[1024] = {0};
recvfrom(sSocket, buf, 64, NULL, NULL, NULL);
cout << buf << endl;
}
getchar();
return 0;
}
Great thanks again.