Re: Test host reachable
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Test host reachable

From: Adrian Ho <tcl@03s.net>
Date: Tue Feb 28 2006 - 12:51:45 CET

On 2006-02-27, antoniofcano@gmail.com <antoniofcano@gmail.com> wrote:
> My real problem is that I've got two host and them know how to reach
> together Local and Remote IPs. The right questio maybe would be How to
> know if I have to use the remote or local IP?
>
> This question comes when I think about two hosts that are in the same
> network... Have I to make a call over Remote IP? not.
>
> The nice solution: Before use Remote or Local, I compare the Remote
> address of the two hosts if they are the same means that both are into
> the same network... Then I have to use the local address.

If the "remote addresses" of the two hosts are the same, wouldn't they
actually be the same host? It's not clear to me that you're performing
the test correctly, since the general solution would be to mask each IP
with the corresponding netmask before comparing for equality.

And when you say "remote or local IP", do you actually mean "private
or public IP"? The rest of your description seems to indicate that,
and if that's the case, then a potentially slower (due to TCP timeouts)
but definitively correct solution is to always try connecting to the
remote IP first, and if that fails, connect to the local IP.

- Adrian
Received on Sun Apr 30 02:17:36 2006