On Sat, May 30, 2015 at 1:42 PM, 黄思亿 <[email protected]> wrote: > void (*uv_read_cb)(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) > > How can I know how many bytes have been read? Should I use nread or > buf->len?
buf->len is the size of the buffer, nread is the number of bytes that have been read into it. It can be zero to indicate nothing was read or < 0 to signal an error, like UV_EOF or UV_EPIPE. You normally close the stream in case of error. -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
