Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Finding IP addresses

Posted on 2006-07-21
2
Medium Priority
?
159 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 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

705 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