Solved

Finding IP addresses

Posted on 2006-07-21
2
158 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

623 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