Re: My IP Address
Re: My IP Address
- Subject: Re: My IP Address
- From: Mark Gilbert <email@hidden>
- Date: Tue, 30 Nov 2004 20:58:42 +0000
>
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.
Well, I may not know completely what I am doing, but I am having a go..:-)
Basically, I am adding a web based control interface to my
application. The idea is that someone could control my app remotely
from another CPU via a web browser.
This is done by a very, very basic web-type server built inside my
app (its just an open socket which spits out simple HTML as a reply
to a client's connection). All the HTML is generated dynamically in
C.
So, first of all, I would like to have a status window in my app's
GUI which tells a local user which address they need to enter
remotely to control the app (without having to look elsewhere in the
computer to find it).
Also, I am creating (in C) an HTML web page with a 'refresh' line, to
make the page automatically reload every 2 seconds (to generate a
live update of status). In order to do that I have to code my own IP
address into the HTML which I return to the client.
So, there are 2 'pre-emptive' reasons why I need to know my own IP
address, before starting any communications with the outside world.
Hope this clears things up. I am sure there are simpler ways to do
this with clever HTML or CGI's, but I am just a humble C programmer
who likes to stick to what I know best, and it all needs to be
wrapped up self contained and auto configuring inside my app.
Thanks for all the replies, I think I have plenty to go on with.
Cheers
Mark Gilbert.
--
email@hidden
Tel: +44 208 340 5677
fax: +44 870 055 7790
http://www.gallery.co.uk
New Product ! - Zen MetaCorder
Location Sound Field Recorder
http://www.metacorder.info
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden