So I'm using Apple's PictureSharing/PictureSharingBrowser samples to send and receive data. This uses an NSFileHandle on the server side to send a picture using NSFileHandle's writeData method.
NSFileHandle * incomingConnection = [[aNotification userInfo] objectForKey:NSFileHandleNotificationFileHandleItem];
[[aNotification object] acceptConnectionInBackgroundAndNotify];
[incomingConnection writeData:dataToWrite];
[incomingConnection closeFile];
This seems to work fine until I want to send large amounts of data (in this case 1MB worth of data). When I attempt this, the application hangs while executing the writeData method. The client doesn't even begin reading the data, it simply opens the connection, but nothing happens. (it's supposed to read the data chunk by chunk, while the server sends all teh data at once).
I'm guessing some deadlock is occurring somewhere, but i'm not sure where. I tried to look for an async. way of writing the data chuck by chuck with NSFileHandle, but i could not find such a way.
Any guidance would help!