• 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: Trying to use NSStream -another question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to use NSStream -another question


  • Subject: Re: Trying to use NSStream -another question
  • From: Andrew Farmer <email@hidden>
  • Date: Sun, 13 Jan 2008 15:12:24 -0800

On 13 Jan 08, at 14:41, Development wrote:
Below is a snippet of the code I'm using for getting the incoming data from the stream. It is cutting download speed from what it should be at around 200Kbps to 22 - 30 Kbps.. I know it is because it reads the data one byte at a time but my attempts to have it read all bytes available have produced much failure. Can any one suggest how to speed this piece of code up? (The main problem I've been having is that if it reads the whole buffer I cannot seem to find the \r\n any where, and so the program cannot find the end of the message from the server. Also when I tre the getBuffer:length: function, the length I get seems always to be 0.

uint8_t oneByte;
actuallyRead = [istream read:&oneByte maxLength:1]; <- if I set max length to 2048 it crashes

Well, yeah, I imagine it would - because you're trying to read 2 kB into a one-byte buffer (and trashing your stack in the process).
_______________________________________________


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: 
 >Trying to use NSStream (From: Development <email@hidden>)
 >Re: Trying to use NSStream (From: Development <email@hidden>)
 >Re: Trying to use NSStream (From: Brady Duga <email@hidden>)
 >Re: Trying to use NSStream (From: Development <email@hidden>)
 >Re: Trying to use NSStream -another question (From: Development <email@hidden>)

  • Prev by Date: Re: Curious about copyWithZone message from NSArrayController in "GC required" project
  • Next by Date: Pattern colors and alpha
  • Previous by thread: Re: Trying to use NSStream -another question
  • Next by thread: Re: Trying to use NSStream
  • Index(es):
    • Date
    • Thread