no you're not reading it correctly. You appear, if I'm reading your mail properly, to think that the GKVoiceChatService exists and makes a connection for you and you can call the

voiceChatService:sendData:toParticipantID:

and at the other end the

receivedData:fromParticipantID:

will be called and you can use it.

methods. But it's the other way around, the voiceChatService:sendData:toParticipantID: is a GKVoiceChatClient protocol method (which is why you can't find it looking in the service documentation). That method you need to write yourself and it has to send the data to the participantID which means whatever your client (which you write) means it to mean. You then have to make your own data connection to that participant (however you wish to do that) and send the data and when the other end receives it, your client calls receivedData:fromParticipantID: (which is a GKVoiceChatService method) to tell it a client wants to connect. It then transfers voice data behind the scenes using the information it just transferred (or if it can't it calls that other realtime method).

So no this thing doesn't provide a free magic connection you can piggy back on, it's a layer built on top of a connection you need to provide which then adds a voice service on top of it. So you still need to write the bit which finds another phone and sends data to and from it.

If you just want local bluetooth connections you can take advantage of the Peer-to-peer networking which gives you a GKSession with send and receive methods, but you want internet I think, so you can't.

(The documentation about configuring peer pickers to use the internet pretty much baffles me, but then I don't know a lot about bonjour.)

James Lin wrote:
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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org

This email sent to r...@rols.org
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to