Archive for December, 2011

Multithreading with CocoaAsyncSocket

Friday, December 2nd, 2011

CocoaAsyncSocket is a fantastic socket library for Cocoa (iOS and MacOS). It comes in RunLoop and GCD flavours, but either way its asynchronous, which means that you can fire off and receive data without your code blocking (which means your code can get on with other things, like providing GUI interactivity, etc.)

However, one of the problems I found with CocoaAsyncSocket (using the RunLoop version) was that despite its asynchronous nature, when building a server application handling multiple sockets that also required interactivity, managing a large number of sockets and packets could cause significant slowdown to my app.

(more…)