iPhone SDK: GameKit and large files + connection lost

iPhone SDK: GameKit and large files + connection lost

Since some time I've been playing with GameKit, but now I'm facing really bad difficulties.

I'm going to send through Bluetooth bigger files - 1-2MB. I've already prepared a packets (about 8kB each).

My app works as described on following scheme:

iPhone - sending header: file divided into 25 parts iPod - received header: OK I got it waiting for 25 parts iPhone - sending part #1 iPod - received part #1 send next iPhone - sending part #2 iPod - received part #2 send next ... iPhone - sending part #24 iPod - received part #24 send next iPhone - sending part #25 iPod receiving part #25 processing file 

I send both file parts and messages (confirmation of delivery) using:

[mSession sendData:data toPeers:mPeers withDataMode:GKSendDataReliable error:nil]; 

and receiving data:

- (void)receiveData:(NSData *)data fromPeer:(NSString *)peer inSession: (GKSession *)session context:(void *)context 

I would like to know how do you deal with some problems that may occur during Bluetooth transmission. Browsing the documentations GKSessionDelegate doesn't give me any info if the data was delivered or not.

In 90% cases the transfer works fine, but sometimes it suddenly stops and doesn't continue without reconnection/restart the app.

I tried to invent a easy solution to set the data again if I won't get the response within 1sec:

-(void)sendAgain {     [self sendData:bufor]; } -(void)sendData:(NSData *)data {     bufor = [data retain];      timeoutTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(sendAgain) userInfo:nil repeats:NO];      [mSession sendData:data toPeers:mPeers withDataMode:GKSendDataReliable error:nil]; } 

timeOutTimer is invalidated if sender received confirmation of successful delivery of file part. But in fact when I implement this solution there are even more problems with this.

Devices are next to each other on the desk.

How do you deal with problems of "undelivered" data between devices? It's just a tool, but how it could be annoying while developing games?

By the way, sending short chats messages never caused any problem and I'm using the same methods.

In fact the connection get lost very rarely, just the data likes to be lost in the air. I'm already dividing the parts so the size of the data is about 8kb, what really makes the transfer of images really really slow.

How can a C# programmer build software for iPhone?


Saving reference to UITableViewCell
The GameKit framework isn't very reliable at this point, even for simple exchange of data for games I work on.

Reformatting for landscape view
I wouldn't use it to transmit large data, you're just asking for headaches..
Fade in/out UIScrollView's content like Mobile Safari does in its tab

warning: declaration does not declare anything

How to Base64 encoding on the iPhone


UIWebView slow loading images--disturbs scrolling to anchors
I agree with both "it" and "refulgentis".

iPhone / .NET WCF Interoperability
Doing this over GK is asking for unreliable execution.

You are better off setting this up over Bonjour and wiFi or having each user download the content from some central offline source.

If your design requires that the big files move from one device to another, you might want to upload them on one side and download them on the other, rather than trying to device-to-device transfer files that large..

68 out of 100 based on 53 user ratings 928 reviews