Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > how to check my ip address ?

Reply
Thread Tools

how to check my ip address ?

 
 
vertigo
Guest
Posts: n/a
 
      05-02-2004
Hello
How can i check my IP address ?
i tried:
ServerSocket myserversocket= new ServerSocket(0);
myserversocket.getInetAddress().getAllByName("loca lhost")
but it receives only 127.0.0.1,
and i have two network cards....

Could anybody help?

Thanx
Michal

 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      05-02-2004
On Sun, 02 May 2004 14:30:22 +0200, vertigo <(E-Mail Removed)> wrote
or quoted :

>How can i check my IP address ?


see http://mindprod.com/jgloss/ip.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
 
 
 
Rob Shepherd
Guest
Posts: n/a
 
      05-02-2004
vertigo wrote:
> Hello
> How can i check my IP address ?
> i tried:
> ServerSocket myserversocket= new ServerSocket(0);
> myserversocket.getInetAddress().getAllByName("loca lhost")
> but it receives only 127.0.0.1,
> and i have two network cards....
>
> Could anybody help?
>
> Thanx
> Michal
>


I have a half finished piece of GPLd code to do exactly this.

http://www.informatics.bangor.ac.uk/~ r o b s h e p/NetworkInterfaceChooser.java

(remove the spaces from the URL - antispam)

At present the main() prints to screen all available network interfaces, addresses and
other bits of info.

The select() method does a bruteforce First come selection.

I will, at some point, make a GUI selection thing for pointclick whatever

The code is part of a GPLd project.

email me at http://www.velocityreviews.com/forums/(E-Mail Removed) for offlist chit chat
 
Reply With Quote
 
CountryCheck.com
Guest
Posts: n/a
 
      05-11-2004
vertigo <(E-Mail Removed)> wrote in message news:<c72plf$bbo$(E-Mail Removed)>...
> Hello
> How can i check my IP address ?
> i tried:
> ServerSocket myserversocket= new ServerSocket(0);
> myserversocket.getInetAddress().getAllByName("loca lhost")
> but it receives only 127.0.0.1,
> and i have two network cards....
>
> Could anybody help?
>
> Thanx
> Michal


The www.countrycheck.com home page shows you the IP address you are
from along with City, State and ISP.
 
Reply With Quote
 
Gordon Beaton
Guest
Posts: n/a
 
      05-11-2004
On Sun, 02 May 2004 14:30:22 +0200, vertigo wrote:
> How can i check my IP address ?
> i tried:
> ServerSocket myserversocket= new ServerSocket(0);
> myserversocket.getInetAddress().getAllByName("loca lhost")
> but it receives only 127.0.0.1,
> and i have two network cards....


Note that getAllByName() is a static method, and doesn't tell you
anything about the address returned by
myserversocket.getInetAddress().

You could have just as well written:

InetAddress.getAllByName("localhost");

which I *expect* to return 127.0.0.1.

Have a look at java.io.NetworkInterface instead:
http://java.sun.com/j2se/1.4.2/docs/...Interface.html

Note too that "ifconfig -a" or "ipconfig /a" will tell you all of your
IP addresses, if you don't need to do this programmatically.

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
 
Reply With Quote
 
Michael Scovetta
Guest
Posts: n/a
 
      05-11-2004
Also not that just because YOU think you're IP is X, doesn't
mean that the rest of the world agrees with you (because of
downline proxies).


Mike

vertigo <(E-Mail Removed)> wrote in message news:<c72plf$bbo$(E-Mail Removed)>...
> Hello
> How can i check my IP address ?
> i tried:
> ServerSocket myserversocket= new ServerSocket(0);
> myserversocket.getInetAddress().getAllByName("loca lhost")
> but it receives only 127.0.0.1,
> and i have two network cards....
>
> Could anybody help?
>
> Thanx
> Michal

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      05-11-2004
On 11 May 2004 05:03:45 -0700, (E-Mail Removed)
(CountryCheck.com) wrote or quoted :

>
>The www.countrycheck.com home page shows you the IP address you are
>from along with City, State and ISP.


for others see http://mindprod.com/jgloss/whois.html
or
http://mindprod.com/jgloss/ip.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      05-11-2004
On 11 May 2004 11:44:12 -0700, (E-Mail Removed)
(Michael Scovetta) wrote or quoted :

>Also not that just because YOU think you're IP is X, doesn't
>mean that the rest of the world agrees with you (because of
>downline proxies).


I use the term "face ip" for the IP the rest of the world thinks you
are.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
brian
Guest
Posts: n/a
 
      05-12-2004
vertigo <(E-Mail Removed)> wrote in message news:<c72plf$bbo$(E-Mail Removed)>...
> How can i check my IP address ?

Hi, why would you want to know it? You should assume that your program
might be run on a computer which is not directly connected to the
internet (dial-up). In that case there is no way to find out your IP
but contacting a server on the internet and have it tell you.
If you are writing the server, too, it's socket will have all the
information which you can easily get and send back to the connecting
client.
This won't work of course if the client and the server run on the same
machine. In that case a local IP will be returned.

I hope that shed some light.

regards
brian
 
Reply With Quote
 
Dirk Michaelsen
Guest
Posts: n/a
 
      05-12-2004
Hi,

>The www.countrycheck.com home page shows you the IP address you are
>from along with City, State and ISP.


forget that page! It tells me, I am from SANTA CRUZ DE TENERIFE on the
Canary islands. Unfortunately I'm not, I'm in Hamburg, Germany

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to selecet check box in the data grid ?? only one check box mit ASP .Net 1 01-25-2006 06:47 PM
how to check all check boxes in repeater control kris ASP .Net 1 09-22-2005 07:16 PM
how to check all check boxes in repeater control kris ASP .Net 0 09-22-2005 06:29 PM
how to check all check boxes in repeater control kris ASP .Net 0 09-22-2005 06:29 PM
.Net Pro include Visual Source Safe or other Code Check in Check out software? Davisro ASP .Net 1 06-14-2004 03:23 PM



Advertisments