Solved

Finding IP addresses

Posted on 2006-07-21
2
153 Views
Last Modified: 2010-04-24
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
0
Comment
Question by:bluedog666
2 Comments
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 500 total points
ID: 17155788
refer following artilces they will help you to retrieve IP address settings on your machine properly :

http://www.experts-exchange.com/Programming/Programming_Languages/MFC/Q_21924111.html <==

http://www.codeproject.com/internet/my_ip_-_v2.asp <== Getting Addresses IP informations

http://www.codeproject.com/internet/bsipconfig.asp <== Review of the network adapter parameters..retrieve adapters settings

http://www.codeproject.com/internet/netcfg.asp <==  The "New ipconfig" and the IP Helper API.. another adapter info retriveal src

http://www.codeproject.com/internet/getipnr.asp <== Get all IP numbers of your machine (latest psdk required)


-MAHESH
0
 

Author Comment

by:bluedog666
ID: 17156655
I guess I was not specific... I was looking for a .net answer WinSock i knew

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 -> IP address: {0}", ips[i]->ToString());
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now