943,754 Members | Top Members by Rank

Ad:
May 25th, 2005
0

Viewing An IP Address in Command Prompt

Expand Post »
Hi!

I was wondering if there's a way to view the IP address of a certain site through Command Prompt. Even better, maybe there's a way to access it through a c++ or java program!

thanx.
Similar Threads
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
May 25th, 2005
0

Re: Viewing An IP Address in Command Prompt

Team Colleague
Reputation Points: 229
Solved Threads: 149
Grandad
Catweazle is offline Offline
3,826 posts
since Mar 2004
May 25th, 2005
0

Re: Viewing An IP Address in Command Prompt

Quote originally posted by C++ ...
Even better, maybe there's a way to access it through a c++ or java program!

thanx.
You can access a site through java without knowing the IP Address. look up the java.net.*; package.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
May 25th, 2005
0

Re: Viewing An IP Address in Command Prompt

server_crash, thanx but i already know that. I wanted 2 make a program that tells u the ip address of the inputted domain name.

thanx anyway.
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
May 25th, 2005
0

Re: Viewing An IP Address in Command Prompt

Quote originally posted by C++ ...
server_crash, thanx but i already know that. I wanted 2 make a program that tells u the ip address of the inputted domain name.

thanx anyway.
The ping command referenced in Catweazle's link will return the IP, although by default it will query a site 4 times, echo a response for every query, and then barf summary statistics on top of that. You can limit the query count with the "-n" switch, but it will still return the stats as well.

You might also check out the "nslookup" command.
DMR
Team Colleague
Reputation Points: 221
Solved Threads: 369
Wombat At Large
DMR is offline Offline
6,439 posts
since Dec 2003
May 25th, 2005
0

Re: Viewing An IP Address in Command Prompt

thanx. one more question. is there a way to return the ip address to a java/c++ program?
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
May 25th, 2005
0

Re: Viewing An IP Address in Command Prompt

Quote originally posted by C++ ...
thanx. one more question. is there a way to return the ip address to a java/c++ program?
This is how you can grab the client ip address:
  InetAddress thisIp =
        InetAddress.getLocalHost();
     System.out.println("IP:"+thisIp.getHostAddress());

Remember to include that in a try catch clause, as that code could potentially cause an exception.

Also, writting a simple servlet would be easier:

String IP = req.getRemoteAddr();
req is an HTTPServletRequest Object.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
May 25th, 2005
0

Re: Viewing An IP Address in Command Prompt

Sorry, you might want to get it by the hostname:

java.net.InetAddress inetAdd =
java.net.InetAddress.getByName("www.ibm.com");
	System.out.println ("IP Address is : " + inetAdd.getHostAddress());
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Windows NT / 2000 / XP Forum Timeline: How to enable auto logon function
Next Thread in Windows NT / 2000 / XP Forum Timeline: I can connect to the net but cannot open sites or messengers





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC