oh well, i had those files, but was missing others so i just updated. works no. kindof...
i've changed my code to this
Code:
#include <winsock2.h>
#include <windows.h>
#include <string.h>
#include <stdlib.h>
bool sendAdress(void);
char listServer[] = "localhost";
bool sendAdress(void)
{
//first get your own IP
char localName[256];
LPHOSTENT localMachine;
//geting host name for local 'puter
gethostname(localName, sizeof(localName));
//making a hostent with above name
localMachine = gethostbyname(localName);
//getting adresses
char localAddrs[1024];
strcpy(localAddrs,"IP for computer name:\n\r");
strcat(localAddrs,localName);
strcat(localAddrs,"\r\n");
for(int i = 0;localMachine->h_addr_list[i]!= 0; i++)
{
strcat(localAddrs,inet_ntoa(*(struct in_addr *) localMachine->h_addr_list[i]));
strcat(localAddrs,"\n\r");
}
//print IP (hopefuly)
MessageBox(NULL,localAddrs,"did you know",MB_OK);
}
int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
{
//first initiate winsock
WORD winsockVersion = MAKEWORD(2,0);
WSADATA wsaData;
WSAStartup(winsockVersion, &wsaData);
//main program
sendAdress();
WSACleanup();
return 0;
}
now i got another friend to test this (seeing as frend above has gone to a festival ) and what he got was his computer name(normal) followed ONLY by his LAN IP. this should work shoudln't it?