views:

563

answers:

2

I have a iPhone app that connects to an IP camera and retrieve MJPEG data using GET method. Everything seems to work find on the simulator, but on the device the UI seems to be blocking: Whenever i receive an image data, I load it into uiimageview. It seems like the only way out is to have AsyncSocket running on a background thread and set the image on the mainThread.

How do I do that for AsyncSocket?

A: 

There is a very simple asynchronous socket pattern that can be created using the NSStream object. Take a look at the WiTap sample on the iphone developer site for an example of how to implement it.

If implemented as in the WiTap example you probably wont have any need for a background thread. Should you still find a need for a background thread keep in mind you will probably have to manually process the runloop for that thread in order to keep your socket's operating properly. Take a look at the NSRunloop documentation for more information on that.

Lounges
A: 

Hi ben, Have you found any answer on this? I also stucked with the same problem.

charith