Re: [iPhone] Network connection between 2 iPhones
Re: [iPhone] Network connection between 2 iPhones
- Subject: Re: [iPhone] Network connection between 2 iPhones
- From: glenn andreas <email@hidden>
- Date: Mon, 13 Jul 2009 11:40:19 -0500
On Jul 13, 2009, at 11:22 AM, James Lin wrote:
the usage scenario...
I want my app to obtain another iPhone(also running my app)'s IP
address from a server.
After that, my app on my iPhone can send data to the other iPhone.
This means my app on another iPhone has to be waiting for this
network traffic to arrive.
How can this be done?
In general, this will only work if the two phones are on the same
local network (such as on the wifi). If that's the case, you can
just use Bonjour for discovery and not even need a remote server.
Otherwise, for example, if the two devices are using 3G to connect to
the internet, even if they are set up to accept connections, the cell
network NAT will disallow incoming connections. More complicated
approaches (google "tcp hole punching" or "NAT Traversal") are needed
for that (and I'm not sure that those techniques will work across cell
networks).
You can, however, have both devices connect to the same remote server,
and have it forward packets between them, but that approach does not
scale well.
You're really going to have to do some more research on networking and
peer-to-peer connections to understand the ramifications of trying to
have one random device talk to another random device.
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures,
fractals, art
_______________________________________________
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