ThomasCle
ThomasCle

Reputation: 6801

Is the GameKit's communication reliable with GKMatchSendDataReliable?

I'm working with GameKit.framework and I'm trying to create a reliable communication between two iPhones.

I'm sending packages with the GKMatchSendDataReliable mode.

The documentation says:

GKMatchSendDataReliable

The data is sent continuously until it is successfully received by the intended recipients or the connection times out. Reliable transmissions are delivered in the order they were sent. Use this when you need to guarantee delivery.

Available in iOS 4.1 and later. Declared in GKMatch.h.

I have experienced some problems on a bad WiFi connection. The GameKit does not declare the connection lost, but some packages never arrive.

Can I count on a 100% reliable communication when using GKMatchSendDataReliable or is Apple just using fancy names for something they didn't implement?

Upvotes: 12

Views: 728

Answers (2)

Yan
Yan

Reputation: 886

My users also complain that some data may be accidentally lost during the game. I wrote a test app and figured out that GKMatchSendDataReliable is not really reliable. On weak internet connection (e.g. EDGE) some packets are regularly lost without any error from the Game Center API.

So the only option is to add an extra transport layer for truly reliable delivery.

I wrote a simple lib for this purpose: RoUTP. It saves all sent messages until acknowledgement for each received, resends lost and buffers received messages in case of broken sequence. In my tests combination "RoUTP + GKMatchSendDataUnreliable" works even beter than "RoUTP + GKMatchSendDataReliable" (and of course better than pure GKMatchSendDataReliable which is not really reliable).

Upvotes: 1

lukaswelte
lukaswelte

Reputation: 3001

It nearly 100% reliable but maybe not what you need sometimes… For example you dropped out of network all the stuff that you send via GKMatchSendDataReliable will be sent in the order you've send them. This is brilliant for turn-based games for example, but if fast reaction is necessary a dropout of the network would not just forget the missed packages he would get all the now late packages till he gets to realtime again.

The case GKMatchSendDataReliable doesn't send the data is a connection time out. I think this would be also the case when you close the app

Upvotes: 0

Related Questions