Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My IP address

 
Dave Jones
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're getting exactly what you're asking for, the local host which is always 127.0.0.1
 
Dave Jones
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u got it???

tell me how??? even i need to know it
 
Abhishek Roy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic