Comments inline.

On Jul 13, 2009, at 10:29 PM, 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?

When using voice chat, the connection is entirely handled by your code. The voice chat service simply handles the audio input and output and packetizing of the audio for transmission and receipt. The connection and sending is all your job.


2. Session can be created over Bonjour service. Can i create a "Session" object from the participantID that I provide for the two iPhones?

In this case, session does not refer to an object. Session is a generic term referring to whatever network setup your code has created.


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?'

This is not a data send service, as covered above. The networking code is entirely up to you. Once you've established your own connection code, you could easily tailor it to hand whatever data you want to send, but the voice chat API won't help with that.


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?

No. These methods only inform you that packetized audio code is ready to be sent and asks you to send it on behalf of the voice chat service. As noted above, the sending is your business.


_______________________________________________

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