[Network] How to get Internet IP

A

Alexandre Jaquet

Hi

I need to find how to get he's own internet ip.

Not the local ip.

Thanks in advance.
 
N

Nils O. =?iso-8859-1?Q?Sel=E5sdal?=

Hi

I need to find how to get he's own internet ip.

Not the local ip.
In java you cannot. Probably if you know what system/os you're on, you
could execute some external program and parse the output, but not
(easily) otherwise.
 
A

Anton Spaans

Use this call

InetAddress ipAddr = InetAddress.getLocalHost();
String numericIP = ipAddr.getHostAddress();

It'll work if your TCP/IP properties are configured ok.

-- Anton.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top