Re: [iPhone] Network connection between 2 iPhones
Re: [iPhone] Network connection between 2 iPhones
- Subject: Re: [iPhone] Network connection between 2 iPhones
- From: "Hank Heijink (Mailinglists)" <email@hidden>
- Date: Mon, 13 Jul 2009 21:13:46 -0400
Have a look at the Witap code sample. It finds other iPhones over
Bonjour and connects sets up a socket connection (I believe it uses
CFNetwork, but I don't have it handy right now). If you need more
info, look at the CFNetwork programming guide - CFNetwork isn't that
bad, and the guide contains enough sample code to get you started.
Hope that helps,
Hank
On Jul 13, 2009, at 12:22 PM, 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?
Thank you again in advance...
James
On 2009/7/14, at 上午 12:11, Roland King wrote:
yes this really was rather too vague a question and if you don't
have some of the basics of networking understood you're going to
have a tough time. There are classes in the OS to deal with various
types of network transfer, most of the NS* ones are reasonably high
level, at the very bottom you have CFSocket which will do anything
you like but needs an understanding of sockets. The GameKit APIs
will let you have a quick bluetooth connection between two or more
devices and is actually darned well designed for startup and
teardown and quick opaque data transfer, if you want more generic
client-server you have more work to do, including finding a method
for telling device B what the IP address of device A is, that's
tough.
Can you possibly narrow down what you're trying to do? Is it
bluetooth (gamekit), is it internet? Do you have a central server
to talk to, are you talking any high level protocols like HTTP
which you can use the higher level APIs for or are you raw data on
a socket?
On Jul 13, 2009, at 11:52 PM, I. Savant wrote:
On Jul 13, 2009, at 11:47 AM, James Lin wrote:
2. When my app is running...it can RECEIVE network data to ANOTHER
IPHONE through the network.
I'm going to assume this is a typo, otherwise you're going to have
a difficult time achieving this goal. :-)
Can you please point me in the right direction?
Documentations to read? tutorials on the web? or please share
your experience...
Since your question is general (I'm assuming you mean "how do I
send and receive"), the answer is general as well:
http://developer.apple.com/iphone/library/navigation/Topics/NetworkingInternet/index.html
https://developer.apple.com/iphone/library/codinghowtos/NetworkingAndInternet/index.html
--
I.S.
_______________________________________________
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:
@runbox.com
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