Re: How to get my IP Address ?
Re: How to get my IP Address ?
- Subject: Re: How to get my IP Address ?
- From: Jerry Pendergraft <email@hidden>
- Date: Mon, 29 Nov 2004 14:44:04 -0600 (CST)
Not sure I completely understand your situtation, but you probably don't
need to know your own ip address. If you send out a packet to another
machine, that packet will contain a source address which is your address.
Such address is put in by the hardware and handles the case of your
machine having multiple interfaces.
The software on the other machine will then use the address in the
packet to reply. If you look in that reply packet the source will be the
peer and the destination will be you.
--
Jerry Pendergraft email@hidden
Endocardial Solutions voice: 651-523-6935
1350 Energy Lane, Suite 110 fax: 651-644-7897
St Paul, MN 55108-5254 mobile: 651-491-0163
On Sat, 27 Nov 2004, Mark Gilbert wrote:
> Folks.
>
> I have setup a very simple socket from one machine to another. I
> want to send back very very simple HTML.
>
> within the HTML I need to include my own IP address, but I am not
> sure how to get it.
>
> I tried gethostbyname("localhost"), but this returns 127.0.0.1 which
> works on the local machine, but is not my address on the network.
>
> For example, I happen to know that my machine is 192.169.1.104, and I
> can reach my machine remotely using this. How does my app learn that
> this is my address ?
>
> I am sure its a really simple trick, but I am obviously missing it.
>
> Cheers
>
> Mark Gilbert.
>
_______________________________________________
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