Using command prompt:
ipconfig
Using C++ code:
list<string> GetIpList()
{
list<string> ret;
char name[1024];
hostent *ips;
if(0 == gethostname(name, sizeof name)) {
ips = gethostbyname(name);
if(NULL != ips) {
int i;
for (i = 0; ips->h_addr_list[i] != 0; ++i) {
in_addr addr;
memcpy(&addr, ips->h_addr_list[i], sizeof(struct in_addr));
ret.push_back(inet_ntoa(addr));
}
}
}
return ret;
}
using C# code:
System.Net.IPAddress[] addresses = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName());
List<string> ips = new List<string>();
foreach (System.Net.IPAddress addr in addresses)
{
ips.Add(addr.ToString());
}