Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to get you Extenal/Real IP (Router)

Reply
Thread Tools

How to get you Extenal/Real IP (Router)

 
 
Thomas Hawtin
Guest
Posts: n/a
 
      04-17-2006
Homer wrote:
>
> I am writing a code as a Java Application (not Applet or Servlet) and I
> am trying to find out what is my real IP address (not 192.168. one). I
> am behind my LinkSys router and everything I try I still get 192.168.


The 192.168.. address is the real IP address of your machine. To get the
IP address of the other side of your NAT router will be router
dependent. For my D-Link router, I'd have to login to the administration
pages and find the IP address amongst the JavaScript.

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
 
Reply With Quote
 
 
 
 
Homer
Guest
Posts: n/a
 
      04-17-2006
Hi All,

I am writing a code as a Java Application (not Applet or Servlet) and I
am trying to find out what is my real IP address (not 192.168. one). I
am behind my LinkSys router and everything I try I still get 192.168.

I have tried:
- InetAddress: Always returns 192.168 address (unless I am missing
something).
- Open Socket to www.cnn.com,80 and read local address (still 192.16.
- I am reading about Upnp but not sure if that's the way I can ask my
Router about my real IP.
- Calling http://www.whatismyip.com and parse the result seems too
strange.


Any idea?

Thanks in advance,

Homer

 
Reply With Quote
 
James McGill
Guest
Posts: n/a
 
      04-17-2006
On Mon, 2006-04-17 at 11:36 -0700, Homer wrote:
>
> - Calling http://www.whatismyip.com and parse the result seems too
> strange.


You can't do it reliably without querying some service that can see the
remote address of the connection, and that means something outside your
gateway. That's why webservices like that are needed, otherwise the
browser would be able to give you the info.

Why do you need the "real" address? If it's not something you can put
in DNS (and reverse DNS), how do you know it won't change between calls
to your function?

 
Reply With Quote
 
Philipp Leitner
Guest
Posts: n/a
 
      04-17-2006

> - Calling http://www.whatismyip.com and parse the result seems too
> strange.


Why's that so bad? Using a Web Service seems to be a good way to solve
your problem - just make sure that you can exchange the service easily
if it is removed for one reason or another.

/philipp
 
Reply With Quote
 
Martin Gregorie
Guest
Posts: n/a
 
      04-17-2006
Homer wrote:
> Hi All,
>
> I am writing a code as a Java Application (not Applet or Servlet) and I
> am trying to find out what is my real IP address (not 192.168. one). I
> am behind my LinkSys router and everything I try I still get 192.168.
>

Visit grc.com or crypto.yashy.com/nmap.php - both are web sites and will
report your firewall's external IP.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
 
Reply With Quote
 
Homer
Guest
Posts: n/a
 
      04-17-2006
To answer to question "why do I need external IP address?":

I have a website hosted somewhere for a little bit of money. The
problem is that hosting company doesn't support PHP, MySql,.... (that
I need for my FamilyTree software)
I have DSL connection as home and I put some small html pages on
hosting site to forward all Not-Supported requests to my home web
server.
Inside those small-html-files I have my dynamic home ip address and I
need to change it whenever my ip address changes.

Now I wrote some code (working great): It runs as service
(wrapper.tanukisoftware.org) and checks my external IP address every 5
second (I am sending httpRequest to http://www.whatismyip.com and parse
the response until I find a better solution). Then it pulls (ftp) my
html files from hosting site, put the new IP and push them back into
the site.

I know that it looks a bit ugly, but it's free and it's working
(with up to 5 sec delay).

 
Reply With Quote
 
Oliver Wong
Guest
Posts: n/a
 
      04-17-2006

"Homer" <> wrote in message
news: oups.com...
> To answer to question "why do I need external IP address?":
>
> I have a website hosted somewhere for a little bit of money. The
> problem is that hosting company doesn't support PHP, MySql,.... (that
> I need for my FamilyTree software)
> I have DSL connection as home and I put some small html pages on
> hosting site to forward all Not-Supported requests to my home web
> server.
> Inside those small-html-files I have my dynamic home ip address and I
> need to change it whenever my ip address changes.
>
> Now I wrote some code (working great): It runs as service
> (wrapper.tanukisoftware.org) and checks my external IP address every 5
> second (I am sending httpRequest to http://www.whatismyip.com and parse
> the response until I find a better solution). Then it pulls (ftp) my
> html files from hosting site, put the new IP and push them back into
> the site.
>
> I know that it looks a bit ugly, but it's free and it's working
> (with up to 5 sec delay).
>


Have you considered using a service like no-ip.com?

- Oliver

 
Reply With Quote
 
Homer
Guest
Posts: n/a
 
      04-17-2006
Nope. I know it's cheap but is not free.
And my code is working. I just want to make it better. I can even put
some code in my Hosting server to return my IP address instead of using
whatismyip.com.

 
Reply With Quote
 
Oliver Wong
Guest
Posts: n/a
 
      04-17-2006

"Homer" <> wrote in message
news: ups.com...
> Nope. I know it's cheap but is not free.
> And my code is working. I just want to make it better. I can even put
> some code in my Hosting server to return my IP address instead of using
> whatismyip.com.


no-ip.com provides different services. The so called "Free" service is
free. See http://www.no-ip.com/services/manage...namic_dns.html

On the other hand, the "Free" service is intended for "personal use
only". Not sure how that fits in with your site (which I believe you
mentioned makes a bit of money). You might want to read the contract
carefully to see what is or isn't allowed.

I used to use the free service, but eventually I just bought a domain
name and a static IP.

- Oliver

 
Reply With Quote
 
Alex Hunsley
Guest
Posts: n/a
 
      04-17-2006
Homer wrote:
> Nope. I know it's cheap but is not free.


No-ip.com is free, I've been using it at work for ages and it's still free.
Also dyndns.org is free. I actually recommend dyndns.org, because they
provide you with a free download called noipDuc (or similar) that runs
on your machine and updates their DNS servers whenever your external IP
changes.

Also, my wireless router (Linksys WRT54G) has a feature in the admin web
pages to allow auto updating of your dyndns address, so I don't even
have to run noipDuc on my desktop machine any more.


> And my code is working. I just want to make it better. I can even put
> some code in my Hosting server to return my IP address instead of using
> whatismyip.com.


I'd seriously avoid doing this in your own code - I appreciate it works,
but it seems inelegant, when dyndns.org works so well and is free.
 
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 Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need to know what the real though put is on a 3600 series router tomarseneault Cisco 3 10-19-2008 05:52 AM
maxtor extenal hard drive bigredfred Computer Support 6 04-28-2005 09:51 PM
how to import an extenal package into java programs k.p.sarma Java 1 01-27-2005 04:35 AM
Router simulators...how do they compare to the real thing? Ed Simmons Cisco 4 12-25-2003 10:42 AM
Using Extenal Javascript file in webcontrol New User ASP .Net 0 12-02-2003 03:19 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57