objective-cgrand-central-dispatchcocoaasyncsocket

How to flush CocoaAsyncSocket?


Is there a way to flush the internal buffers/queues/etc. of CocoaAsyncSocket (GCDasyncSocket)?

I want to setup the environment that when I call the [... readDataWithTimeout ..] method, I don't want it to read any left over garbage data from a previous connection that might have been buffered and sitting somewhere.

Or sometimes I just want to ignore a stream of data and start over, so want to ensure a clean pipe.


Solution

  • I've also asked this question in the CocoaAsyncSocket Google Group and Robbie Hanson was kind enough to elaborate with his answer.