Click to See Complete Forum and Search --> : How can I get the my PC IP address ?


wxuf
September 28th, 2005, 05:20 AM
Hi...

I use VC++6.0, xp os.
I want to get my pc address by program, how to do it ?

Every suggestions is appreciated !

wxuf

Naumaan
September 28th, 2005, 05:57 AM
You can use gethostname and then gethostbyname to get ur system IP address. Take a look at Platform SDK: Windows Sockets 2 (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/gethostbyname_2.asp)

Mathew Joy
September 28th, 2005, 06:44 AM
Additionally look at the following FAQ...

How to get the local IP address(es)? (http://www.codeguru.com/forum/showthread.php?t=233261)

dazhutou
September 28th, 2005, 09:30 PM
I'm using JAVA as the programming language. I connect 3 pc through hub. 1 pc is the main pc to control the other 2. Can you teach me how to get the 2 pc's ip address from the main pc. Is it using gethostname or gethostnameby?

Your answer is really appreciated.