开发者

Writing asynchronously on a stream in cocoa

开发者 https://www.devze.com 2022-12-20 13:11 出处:网络
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 du

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号