Thanks Ben, does a return code of true and the callback being called mean exactly the same thing? Do both give the same guarantee?
The reason I ask is because I am pre-allocating a buffer for a websocket server, and this is overwriting the buffer as soon as write returns true or the callback is fired. I noticed that for large writes it's overwriting data before it gets to the client. Joran Greef RONOMON On Wed, Jul 17, 2013 at 11:02 PM, Ben Noordhuis <[email protected]> wrote: > On Wed, Jul 17, 2013 at 4:01 PM, Joran Dirk Greef <[email protected]> > wrote: > > I have a question regarding how TLS socket write works and am going > through > > the source now too. > > > > The documentation details this behavior as: > > > > "Returns true if the entire data was flushed successfully to the kernel > > buffer. Returns false if all or part of the data was queued in user > memory. > > 'drain' will be emitted when the buffer is again free. The optional > callback > > parameter will be executed when the data is finally written out - this > may > > not be immediately." > > > > If I pass a 1mb-2mb buffer to write(), does a true return code or > executed > > callback guarantee that I can overwrite parts of that buffer, without > > changing any data that was passed to the write? > > Yes. > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to a topic in the > Google Groups "nodejs" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/nodejs/BC2ULjPqTi4/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
