开发者

How to signal the disconnecting/closing of a NSOutputStream to the endpoint of the stream?

I send up a tcp network connection via NSNetService(Browser).

Later i like to close the connection and inform the endpoint of the stream about.

I properly close the streams, remove them from the runloop, set the delegate nil and dispose the stream objects, but the receiver wan't get any event.

If i force quit/stop debugging the application then the receiver wi开发者_StackOverflow中文版ll immediately get the NSStreamEventEndEncountered Event.

Is there a way to send a NSStreamEventEndEncountered to the receiver ?

The best would be a solution that works booth iOS and OSX.


I found the answer myself ...

Later when i start to close the connection i suppose to get the streams to close via [NSNetService getInputStream: OutputStream] and then i try to close these streams. But i will get different streams, other when i open them. So i keep a pointer to the opend streams and close this ones later. And then it works.

ploenne

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜