[iPhone] Network connection between 2 iPhones-Can GKVoiceChat be my solution?
[iPhone] Network connection between 2 iPhones-Can GKVoiceChat be my solution?
- Subject: [iPhone] Network connection between 2 iPhones-Can GKVoiceChat be my solution?
- From: James Lin <email@hidden>
- Date: Tue, 14 Jul 2009 13:29:02 +0800
Hi all...
Continuing on with my network between 2 iPhone quest...
Thanks to Luke who made me aware of Game Kit and GKVoiceChat.
As I am new to network programming, I need you to help me make sense
of the documentation.
If I am reading the GKVoiceChat documentation correctly...GKVoiceChat
works in the following manner:
1. provide each client with an arbitrary participant ID and try to
connect through GKVoiceChatService (is it a server/service provided by
Apple?), and
the service will allow the 2 iPhones to discover each other and make
connection?
2. Session can be created over Bonjour service. Can i create a
"Session" object from the participantID that I provide for the two
iPhones?
3. There is a method called voiceChatService:sendData:toParticipantID:
as part of the protocol.
The documentation says:
Implement the client’s voiceChatService:sendData:toParticipantID:
method.
- (void)voiceChatService:(GKVoiceChatService *)voiceChatService
sendData:(NSData
*)data toParticipantID:(NSString *)participantID
{
[session sendData: data toPeer:[NSArray arrayWithObject: participantID]
withDataMode: GKSendDataReliable error: nil];
}
The service calls the client when it needs to send data to other
participants in the chat. Most commonly,
it does this to establish its own real-time connection with other
participants. As both the GKSession
and GKVoiceChatService use an NSData object to hold their data, simply
pass it on to the session.
If the same network is being used to transmit your own information,
you may need to add an identifier
before the packet to differentiate your data from voice chat data.
Does this mean I can also send my own data over the internet through
this service once a voicechat connection is made?
4. Anyone know if sample code is available anywhere on the net for
GKVoiceChat?
5. In the Game Kit Programming Guide documentation, it mentioned two
methods
voiceChatService:sendData:toParticipantID:
voiceChatService:sendRealTimeData:toParticipantID:
However, these two methods are mysteriously missing from the
GKVoiceChatService Class documentation.
Am I missing something?
If I am reading the documentation correctly: does this mean I can use
the GKVoiceChatService that discovered each through
the service and SEND MY OWN DATA between the two iPhones?
If my impressions are correct, this class might be the solution I am
looking for...
Can you please help me confirm?
Thank you in advance...
James_______________________________________________
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