Re: [Q] disposing of a stream object when NSStreamEventEndEncounterered is received?
Re: [Q] disposing of a stream object when NSStreamEventEndEncounterered is received?
- Subject: Re: [Q] disposing of a stream object when NSStreamEventEndEncounterered is received?
- From: Michael Ash <email@hidden>
- Date: Tue, 27 Jan 2009 17:54:57 -0500
On Tue, Jan 27, 2009 at 2:25 PM, JongAm Park
<email@hidden> wrote:
> Hello.
>
> According to "Stream Programming Guide for Cocoa : Writing to Output
> Streams", it says :
>
> "When an NSOutputStream object concludes writing data to an output stream,
> it sends the delegate a |NSStreamEventEndEncountered| event in a
> |stream:handleEvent:| message. At this point the delegate should dispose of
> the stream object by doing the mirror-opposite of what it did to prepare the
> object. In other words, it should first close the stream object, remove it
> from the run loop, and finally release it."
>
> However, I have a system with which a server send back a notification when a
> client registers that it want to get some notification to the server. For
> the system, a stream or a channel which requested the notification should be
> remained open to get notifications from the server afterwards.
>
> Under this scenario, can't I use the Run-Loop based meachanism? is there any
> way to keep the stream open?
I'm afraid I don't understand your message. What's the actual problem
here? When you receive NSStreamEventEndEncountered it's because the
stream has reached its end and no more data will be forthcoming. With
a network stream, it will occur because the other side (or some
network problem) has closed the stream. You obviously cannot read
server notifications out of a stream after this happens. And none of
this has anything to do with runloops.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden