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.


Disable iphone home button in app, is it possible?

1:

refreshing mkannotation properties and refreshing the annotation
The GameKit framejob isn't very reliable at this point, even for simple exchange of data for games I job on. swipe to delete when already in edit modeI wouldn't use it to transmit large data, you're just asking for headaches.. Embedding WebView in UIView
Problem sending Apple Push Notification using Java and RESTGiven a view, how do I get its viewController?

2:

asp.net controls for iPhone development
I agree with both "it" and "refulgentis". Generating Random Numbers in Objective C for iPhone SDK 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 any central offline source. If your design requires this 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 endeavor to device-to-device transfer files this large..


68 out of 100 based on 43 user ratings 458 reviews