IPhone: sending big data with the Game Kit

I am trying to write an application that communicates with other iPhones running the application through the framework of the Game Kit. IPhones detect each other and connect perfectly, but problems arise when I send data. I know that the iPhone is connected correctly, because when I serialize an NSString and send it through the connection, it goes to the other end. But when I try to archive a larger object (using NSKeyedArchiver), I get the error "Error AGPSessionBroadcast (801c0001)".

I guess this is because the data I'm sending is too large (my files are about 500 thousand in size, Apple seems to recommend a maximum of 95 thousand). I tried to split the data into multiple transmissions, but I can never parse them on the other end. I am wondering if anyone else has run into this problem and how you solved it.

+5
source share
2 answers

I had the same problem with files around 300K. The problem is that the sender must know when the receiver emptied the pipe before sending the next fragment.

, . , . , , .

, , , #. #, .. .. , ( , , , , , , ..). , / , , , .

( ), . 5K, . 10K, , 8096. , .

+4

, GameKit API- ; , , .. 300k , , API .

, TCP-; UDP (). ( TCP), . ( UDP IP-, , UDP , TCP, ).

MTU ~ 1.5k; bluetooth, ~ 0.5k. , UDP-, (a), , (b) IP- MTU (c) , .

- TCP - ​​ . , . NSKeyedArchiver, , ( , ). - ACK , ACK, , , .

+3

All Articles