Re: [iPhone] networking
Re: [iPhone] networking
- Subject: Re: [iPhone] networking
- From: Roland King <email@hidden>
- Date: Thu, 06 Aug 2009 16:13:43 +0800
James Lin wrote:
How does Bonjour handle the task of introducing 2 iPhones (located in 2
parts of the world) to each other?
it basically doesn't. Bonjour can work over network segments which have
been bridged for multicast dns (I think) but in general it doesn't work
outside a LAN.
The documentations i've found so far all point to Bonjour working on
local network only, (even on Apple's website).
Can you please point me to the documentation where it explains how
Bonjour works over the "internet"?
I've never seen any. I assume that as well as multicast dns there are
ways to configure bonjour to point to some central DNS server which
would enable something like that to work but I've not seen documentation
as to how, and I went looking for it a while ago when I was on a 'what
the hell is bonjour' discovery quest.
My goal:
1. 1 iPhone running my app working as a server waiting for connection
from another iPhone from the "internet".
2. Another iPhone running my app working as a client connects to the
server iPhone and send a string "hi, I am James".
3. The server iPhone, upon receiving this string reply with user's
choice of either String A or String B back to the client iPhone.
From the comment below...if an iPhone is never going to have a public
IP address...
How do I make 1 iPhone connect to another?
You basically can't, and people have been trying to tell you this for
some time now, most of the replies to your questions have said exactly
that, you can't network through NAT, phones don't have public IP
addresses, or they rarely do.
The comment about IPv6 was quite interesting .. true that if that is
ever implemented worldwide then possibly every device will have its own
IP address, but it's not and the growth of NAT-based solutions for the
limited IP address space seems to have taken the hurry up out of a lot
of IPv6 initiatives, so I'm not expecting to see it anytime soon.
So what can you do with a phone, well you can connect *to* something,
but you cannot listen and have someone connect *to* you. So, and this
has been suggested a number of times too, if you run a central server
then each phone can individually connect to that, and it can pass
messages between them for you. That would work. But you need a server,
on a public IP, that you can run a long-running server process on.
By the way - and I think I said something about this before - in your
ideal world where phones did have public (although regularly changing)
IP addresses .. how was phone A going to find phone B in the first
place? That is hard, that's what phone companies do when you dial
numbers, they find the phone attached to them, how were you going to do
it? In that case a server helps you again, you don't NEED to find the
phone, the phones each find the server, and they know where that is, and
then that connects them based on <insert your form of phone ID here>.
Sorry for the repeating question...I am just getting more and more
confused instead so far...
Thank you in advance...
James
On 2009/8/5, at 上午 2:13, Luke the Hiesterman wrote:
On Aug 4, 2009, at 11:10 AM, James Lin wrote:
Bonjour is for local area network, right?
No, Bonjour is applicable to any networking, local or wide area.
Here's some sample code.
http://developer.apple.com/iphone/library/samplecode/BonjourWeb/index.html
Luke
On 2009/8/6, at 上午 7:58, glenn andreas wrote:
On Aug 4, 2009, at 4:42 PM, Shawn Erickson wrote:
On Tue, Aug 4, 2009 at 11:13 AM, Luke the
Hiesterman<email@hidden > wrote:
On Aug 4, 2009, at 11:10 AM, James Lin wrote:
Bonjour is for local area network, right?
No, Bonjour is applicable to any networking, local or wide area.
Here's some
sample code.
http://developer.apple.com/iphone/library/samplecode/BonjourWeb/index.html
Well ad-hoc discovery only works on the local sub-net or across
bridged sub-nets. To do service discovery across sub-nets would
require a known DNS server publishing the existence of services and
how to contact them via public IP addresses.
Of course, in the context of the original question (re: iPhone
networking), the iPhone is almost never going to have a public IP
address (being hidden behind WiFi or cell phone NATs).
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
Mad, Bad, and Dangerous to Know
_______________________________________________
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
_______________________________________________
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