Writing asynchronously on a stream in cocoa
I have been trying to find any way for writing asynchronously on a stream in Cocoa.
I have a set of events in my applications which will try to send data through the socket but i can't be blocked during this transmission due to design terms.
I have tried setting a delegate on the output stream and check the event NSStreamEventHasSpaceAvailable but I don't know how this can be combined wi开发者_运维问答th the events that put data into the stream.
Is there anyway for doing that? I thought using NSThread but I guess there is a better option.
Cheers
Check out: Writing To Output Streams
If writing the data is slowing the main thread and you don't want to make a separate thread, try reducing the amount of data written for each event - that will probably improve performance.
精彩评论