Re: At a loss figuring out if an IP is on LAN or INET
- From: david <david@xxxxxxxxxxxxxxxx>
- Date: Sat, 29 Apr 2006 09:25:55 -0700
On 2006-04-29, Chris Chilvers <keeper@xxxxxxxxxxx> wrote:
This gets into what I mentioned before, the complications of adding a
server host to the two clients. I'm not entirely sure the OP needs
this, although it's an interesting problem.
Not knowing the particular problem I just thought you may be trying this
as some sort of speed optimisation. If the two computers are on the same
subnet try sending using internal ip's (like MSN). For this you could:
* query both clients for internal ip/subnet, and client A for port X to
connect to
* mask ips and compare. If equal you can now send to each client,
internal ip and external ip (and to client B, port X from A)
I still don't see how using the subnet mask helps anything here. The
fact that two ip addresses are on different subnets doesn't tell you
whether to use the internal IP or the external IP.
What the server probably wants to check here is whether the IP in the
packet header matched the IP in the packet data. That would tell you
whether the packet was NATted, which is what you really want to know.
You might also want to check whether hosts A and B had the same external
IP both in the packet data and the packet header, which would let you
identify situations where A and B are local to each other but remote
from the server.
* the sever tells client A to expect a connection from A's internal or
external ip (probaly want to have A send some sort of random key to the
server that can be sent to B)
* client B can now try to connect on the internal ip, if that fails it
could retry the external ip (and the first thing it needs to send is
that secrect key or A or A will close the connection)
.
Along with all this automatic discovery you could allow power users to
decide they really do know better and have a config somewhere, where
they can set what IP address to send to the server. This gives us two
types of IP sent from the client to the server; internal IP/subnet, and
forced IP (no subnet as we're now telling the server to always use this
IP, should disregard the external IP unless this is some sort of
automate regular connection which could result in a DDOS if misused)
- Follow-Ups:
- Re: At a loss figuring out if an IP is on LAN or INET
- From: Chris Chilvers
- 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
- Re: At a loss figuring out if an IP is on LAN or INET
- From: david
- 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
- From: david
- 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
- From: Chris Chilvers
- Re: At a loss figuring out if an IP is on LAN or INET
- From: Chris Chilvers
- At a loss figuring out if an IP is on LAN or INET
- Prev by Date: Re: Ent Library. Substitute data from app.config?
- Next by Date: Re: At a loss figuring out if an IP is on LAN or INET
- 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
|