views:

51

answers:

1

Hi folks

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 with 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

A: 

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.

tedge