aspose file tools*
The moose likes Beginning Java and the fly likes My IP address Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "My IP address" Watch "My IP address" New topic
Author

My IP address

Dave Jones
Ranch Hand

Joined: Feb 20, 2005
Posts: 77
Hello
I'm writing a program and I need to get my IP address (i.e 12.34.123.123 )
I tryed using this code,

but I get:
127.0.0.1 as my address.....not very helpful eh ?...
does someone have a short code sample that will give me what I need ??
Thanks
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
You're getting exactly what you're asking for, the local host which is always 127.0.0.1


42
Dave Jones
Ranch Hand

Joined: Feb 20, 2005
Posts: 77
I know, but I need the real ip address not 127.0.0.1 !!
never mind, I got it already.
thanks anyway :roll:
Grishma Dube
Ranch Hand

Joined: Jul 01, 2003
Posts: 275
u got it???

tell me how??? even i need to know it
Abhishek Roy
Greenhorn

Joined: Feb 07, 2003
Posts: 4
This may helpful

Run as (for IPv4)$java lookupAndReturn abhiroy.com
OR as (for IPv6)$java -6 lookupAndReturn abhiroy.com


[ March 17, 2005: Message edited by: Abhishek Roy ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: My IP address