Re: Determine My IP Address
Re: Determine My IP Address
- Subject: Re: Determine My IP Address
- From: "Duane Murphy" <email@hidden>
- Date: Mon, 24 Apr 2006 11:42:34 -0700
--- At Mon, 24 Apr 2006 10:43:16 +0100, Quinn wrote:
>At 20:34 -0700 23/4/06, Duane Murphy wrote:
>>Unfortunately, it's part of a specification that has these requirements.
>>This is a specification agreed upon by a large consortium that is not
>>about to change this now.
>
>UPnP perhaps? (-:
Not exactly, but close enough.
>How do you send the IP address to the remote machine? If you send it
>via UDP, the best solution is for you to connect the UDP socket to
>that address. This will force that socket to bind to a particular
>interface (based on the routing tables at that point in time), and
>getsockname will return its IP address. This may not work (a good
>outgoing path for UDP does not imply a good return path), but it
>probably will.
>
>If you send the IP address to the remote host via TCP, you're golden.
>Open a TCP connection, then call getsockname on that socket, then
>assemble and send your data. This is more-or-less [1] guaranteed to
>work, because the TCP connection won't open unless there's a valid
>return path to that IP address.
>
>[1] Well, there are always circumstances where things like this fail.
>If there's a NAT between you and the remote host, for example. Or if
>the firewall is blocking incoming connections to your server port.
>Still, it's a good place to start.
Bingo! The message is HTTP (so TCP). This will work great. It also let's
us preflight the other end to make sure we can connect!
Thanks for the great idea, Quinn!
...Duane
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden