Re: [iPhone] get iPhone's IP address...
Re: [iPhone] get iPhone's IP address...
- Subject: Re: [iPhone] get iPhone's IP address...
- From: Peter Duniho <email@hidden>
- Date: Mon, 20 Jul 2009 01:39:11 -0700
On Jul 19, 2009, at 11:51 PM, Kyle Sluder wrote:
On Jul 19, 2009, at 11:36 PM, KK <email@hidden> wrote:
Does the iPhone have NSURLConnection? If so, you can just point
that to
www.whatismyip.com or a similar site, and just parse the information.
This is ridiculous. Send an HTTP request to an unreliable third
party and parse the unwarranted contents of the HTML response, which
may be incorrect? As opposed to accessing the information locally
accessible?
It's only ridiculous if the information is indeed locally accessible.
It really depends on why the OP wants the IP address in the first
place, which we don't actually have any information about right now.
It's unusual for an application to even need to know its own IP
address, and others have already pointed out a variety of problems
with the idea. It's entirely possible that the OP is mistaken about
even needing this information.
But, let's assume for the sake of discussion that he's not mistaken
and that he really does need it.
If you are connected behind a NAT router, proxy server, etc. and need
to know what your _public_ Internet address is, sometimes the only way
to do it is to ask someone else (e.g. you won't always have UPnP or
similar protocols to rely on).
There's a reason www.whatismyip.com and web sites like it exist. I'm
not suggesting that exact web site is the best way to find out the IP
address needed, but the idea isn't necessarily as ridiculous as one
might think.
Pete
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden