bluedog666
asked on
Finding IP addresses
Hi,
I was wondering, how could I get a list of the IP addresses of a machine (the program is running locally).
I need to initialise two TcpListener threads on a machine with two network cards and at this point they are hardcoded...
I am looking for something equivalent to the old gethostbyname from winsock...
Any ideas?
Alex
I was wondering, how could I get a list of the IP addresses of a machine (the program is running locally).
I need to initialise two TcpListener threads on a machine with two network cards and at this point they are hardcoded...
I am looking for something equivalent to the old gethostbyname from winsock...
Any ideas?
Alex
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ont he other hnd, if this ill help anyone I managed to find what I was looking for....
System::String^ hostName = Dns::GetHostName();
Console::WriteLine( "SERVER -> Computer name : {0}", hostName );
array<IPAddress^>^ ips;
ips = Dns::GetHostAddresses (hostName);
array<unsigned char>^ ip_address = gcnew array<unsigned char>(100);
for(int i = 0; i < ips->Length; i++)
Console::WriteLine("SERVER