CStringArray straIPAddresses;
straIPAddresses.RemoveAll();
WSADATA wsa_Data;
int wsa_ReturnCode = WSAStartup(0x101,&wsa_Data);
char szHostName[255];
gethostname(szHostName, 255);
struct hostent *host_entry;
host_entry = gethostbyname(szHostName);
int nAdapter = 0;
while ( host_entry->h_addr_list[nAdapter] )
{
char * szLocalIP;
szLocalIP = inet_ntoa (*(struct in_addr *)host_entry->h_addr_list[nAdapter]);
nAdapter++;
straIPAddresses.Add(szLocalIP);
}
WSACleanup();
2 comments:
Nice one!
DO you know of some proofed method for changing your IP address if you ISP is assigning you fixed IP?
You can use one of the free proxy servers. Or you can turn off your ADSL modem, wait few seconds and turn it on, again :)
Post a Comment