Re: At a loss figuring out if an IP is on LAN or INET
- From: david <david@xxxxxxxxxxxxxxxx>
- Date: Fri, 28 Apr 2006 13:42:40 -0700
On 2006-04-28, Terry Olsen <tolsen64@xxxxxxxxxxx> wrote:
I'm writing an app that communicates with computers both inside and outside
my router. So I need to determine by the remote host's IP address if I need
to send them my LAN IP or my Internet IP. Someone suggested AND'ing the IP
and my Subnet Mask but I come up with this:
My IP: 192.168.0.14
Mask: 255.255.255.0
Result: 192.168.0.0
Should I just compare the first two octets? Or are there situations where
this would provide incorrect results?
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.
.
- Follow-Ups:
- Re: 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
- References:
- At a loss figuring out if an IP is on LAN or INET
- From: Terry Olsen
- At a loss figuring out if an IP is on LAN or INET
- Prev by Date: Re: "Send To Mail Recipient"
- Next by Date: Re: Stepping between .Net IDE into a VB6 dll call
- 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