Re: At a loss figuring out if an IP is on LAN or INET
- From: "Terry Olsen" <tolsen64@xxxxxxxxxxx>
- Date: Fri, 28 Apr 2006 20:17:06 -0600
I'm curious, why do you need to do this? The remote host should already
know how to respond to you. If you're sending an IP to a third host
that distributes the IP (like many P2P networks), then using the IP
address to determine local vs. remote isn't going to help you, because
you'll have conflicts with identical addresses.
There should not be any identical addresses. I am writing a P2P application
that communicates via UDP (as an experiment, I know UDP isn't reliable for a
chat application). I want to be able to communicate with other peers both
inside and outside my router. Since there is no TCP connection from which to
read the remote IP address, when one peer sends a message to another, it
also sends the return IP address. So I need to be able to determine if the
peer is inside or outside my router so I know which IP address to send as
the return address. I won't be sending my "192.168.x.x" address to anyone
outside my router, and I should not received a private IP from anyone
outside my router.
I believe I understand now how to get the "network address" by AND'ing the
Subnet Mask with with each IP and comparing the results. I'm going to try
that.
.
- Follow-Ups:
- References:
- At a loss figuring out if an IP is on LAN or INET
- From: Terry Olsen
- Re: At a loss figuring out if an IP is on LAN or INET
- From: david
- At a loss figuring out if an IP is on LAN or INET
- Prev by Date: Re: TAG Property
- Next by Date: Is there an easy way to get my Subnet Mask?
- Previous by thread: Re: At a loss figuring out if an IP is on LAN or INET
- Next by thread: Re: At a loss figuring out if an IP is on LAN or INET
- Index(es):
Relevant Pages
|
Loading