Re: [APPL:DarwinDev] Re: How to get my IP Address ?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com User-agent: Mutt/1.4.2.1i On Mon, Nov 29, 2004 at 05:30:10PM -0800, Jan Brittenson scratched on the wall:
The problem with the question is: if the client managed to connect to the web server, why does it need to ask for an address? A cgi-bin to figure out a local address to send back to the client that's already connected to it is somewhat pointless.
It isn't pointless because you're assuming those addresses are the same, and that's a very bad assumption because of NAT. In fact, there are several web servers that offer the opposite service-- you connect, and they say "you came from THIS address." If the client is behind a NAT box, the reported address may or may not be different than what your local machine thinks its own address is. In fact, if you need to register a "client" with a dynamic DNS service or something like that, an external reverse probe like this is essential to getting the correct globally-routed address. I'm not sure what the original poster is trying to do, but I assume they know what they are doing. I'll make the standard soap-box speech that network protocol design is very very difficult-- even at the application layer-- and you should really know what you're doing if you are trying to roll your own; that includes the standard warning that unless you are specifically trying to do some type of NAT discovery system, encoding end-point IP addresses in an application protocol stream is usually a Bad Idea, not the least of which is because it is easy for the system to lie. That said, there are still reasons why you might want to do this, especially in a NAT environment. It's just too bad they can't use a standard server like Apache. This could be solved with a dozen line script that simply returns the CGI env var "SERVER_ADDR". It's also worth pointing out that this _is_ a standard CGI env var, meaning somebody somewhere thought it was important enough to provide. -j -- Jay A. Kreibich | Comm. Technologies, R&D jak@uiuc.edu | Campus IT & Edu. Svcs. <http://www.uiuc.edu/~jak> | University of Illinois at U/C _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Jay A. Kreibich