[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Query regarding bufferevent_read_buffer



I got it. Thanks a lot for clarification. :-)

DJ

On Wed, Jun 1, 2011 at 8:50 PM, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
On Tue, May 31, 2011 at 1:40 PM, deepak jain <deepakjain111@xxxxxxxxx> wrote:
> Hi Nick,
> Thanks a lot for your reply.
> One more doubt about bufferevent.
> As in socket networking programming, Sometimes It may require more than one
> read/recv in server side for a single write by a client, depending upon
> server socket's read buffer availability. Similarly here our read callback
> may get call more than one for a single write by a client depending upon
> server socket's read buffer availability. Specially If you are going to deal
> with big chunk of data. Am i correct here?

Right.  There is no predicting exactly how many times the read
callback on a bufferevent will get invoked: your program should not
rely on the exact number.  The only guarantee you get is that the
callback is invoked when more data arrives[*].  A well-behaved program
won't depend on the data on a TCP stream arriving in any particular
increment of size.

[*] actually, the guarantee is that it gets called when enough data
arrives to put the size of the inbuf at or over the read
low-watermark.  But since that defaults to zero, you can approximate
it with "the callback is invoked when more data arrives" unless you
are changing the callbacks.

cheers,
--
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.