Re: NSInputStream created from NSData - expected it to close at end of data, did not happen
Re: NSInputStream created from NSData - expected it to close at end of data, did not happen
- Subject: Re: NSInputStream created from NSData - expected it to close at end of data, did not happen
- From: Jens Alfke <email@hidden>
- Date: Thu, 02 Jun 2011 11:40:56 -0700
On Jun 2, 2011, at 2:10 AM, email@hidden wrote:
> Hi all,
>
> I wanted to have a very basic TCP server that could return arbitrary bytes when a client connected to it to test whether some protocol (on top of TCP) code I wrote works as expected. To do so I adapted the CocoaEcho example (http://developer.apple.com/library/mac/samplecode/CocoaEcho/Introduction/Intro.html ).
You might want to look at my MYNetwork library <http://bitbucket.org/snej/mynetwork> which is a higher-level TCP networking API.
> But the inputDataStream seems to never get closed. I would have expected it to be closed when it reaches the end of the underlying data.
No, that’s not how streams behave. They close when you close them, not automatically.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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