Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 877
ThomasCle Avatar asked Aug 23 '12 10:08

ThomasCle


1 Answers

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).

like image 151
Yan Avatar answered Oct 20 '22 00:10

Yan