• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSStream or when NSStreamEventEndEncountered appears too late
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSStream or when NSStreamEventEndEncountered appears too late


  • Subject: Re: NSStream or when NSStreamEventEndEncountered appears too late
  • From: Andrew Farmer <email@hidden>
  • Date: Wed, 21 Nov 2007 14:57:27 -0800

On 21 Nov 07, at 14:44, Kubernan At 10191 Technologies wrote:
I'm studying the NSStream class and its concrete subclasses.
For that i wrote a very simple NNTP (usenet) client app.

In this application i use the run-loop scheduling streams technique.

I'm able to catch all stream events but NSStreamEventEndEncountered appears about 4 minutes after reading the last NNTP response (i.e. the end of the input stream) :

If i send the "LIST" command (give me the list of the newsgroups) to the NNTP server, i receive the response via several NSStreamEventHasBytesAvailable events. In the NNTP protocol the end of a response for such a command is @".\r\n" sequence. I have this sequence in an ultimate NSStreamEventHasBytesAvailable event.
For me it means the end of the input stream, but the NSStreamEventEndEncountered event comes 4 minutes after... and there is no other event between the end of the response and the end event.


The apple doc says "....When an NSInputStream object reaches the end of a stream, it sends the delegate a NSStreamEventEndEncountered event...". Maybe i didn't well understand what "end of a stream" really means.

Do you have an idea why i receive the NSStreamEventEndEncountered event so long after the last NSStreamEventHasBytesAvailable ?

"End of a stream" means the connection has closed down completely - this is apparently only happening after the server times out. There's no application-independent way to detect the end of an individual transmission on a TCP stream; you'll need to detect the end-of-listing marker yourself and respond to it yourself.
_______________________________________________


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


References: 
 >NSStream or when NSStreamEventEndEncountered appears too late (From: Kubernan At 10191 Technologies <email@hidden>)

  • Prev by Date: NSStream or when NSStreamEventEndEncountered appears too late
  • Next by Date: Re: Concurrent NSOperation
  • Previous by thread: NSStream or when NSStreamEventEndEncountered appears too late
  • Next by thread: XCode 3 Debugger bug?
  • Index(es):
    • Date
    • Thread