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

Re: [Libevent-users] evbuffer - how to read without draining data?



On Mar 31, 2010, at 10:02 AM, Jarod Liu wrote:

> Hi,
> I writing a eventbuffer socket app. My app packet have a length
> header, I want to read data only when input buffer length > packet
> length(I need to read the length header first). But it seems like I
> can't read from evbuffer without draining data. Is there a way to do
> that?

Hi,

You can do evbuffer_pullup() with the size of your length header and reading the length header from the returned pointer.

Best regards,
Sebastian Sjöberg


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

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