Re: [Libevent-users] Unable to construct simple socket client with bufferevent

2010-03-31 Thread Nick Mathewson
On Wed, Mar 31, 2010 at 11:53 AM, Anomit Ghosh wrote: > I'm basically trying to a write a very simple echo server/client > combination, just for trying out libevent. The server doesn't use > libevent's bufferevent, but the client does. > > Code for server: http://codepad.org/nP0KsfPY > Code for cl

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

2010-03-31 Thread Nick Mathewson
On Wed, Mar 31, 2010 at 7:10 AM, Sebastian Sjöberg wrote: > 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 fi

[Libevent-users] Unable to construct simple socket client with bufferevent

2010-03-31 Thread Anomit Ghosh
I'm basically trying to a write a very simple echo server/client combination, just for trying out libevent. The server doesn't use libevent's bufferevent, but the client does. Code for server: http://codepad.org/nP0KsfPY Code for client: http://codepad.org/XRJAVg5m The problem seems to be that e

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

2010-03-31 Thread Sebastian Sjöberg
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 drain

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

2010-03-31 Thread Shuo Chen
can you read the length header (four bytes I guess?) and keep it somewhere in your program, and then wait for enough data to be readable? Regards, Shuo Chen On 3/31/10, Jarod Liu wrote: > Hi, > I writing a eventbuffer socket app. My app packet have a length > header, I want to read data only whe

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

2010-03-31 Thread Jarod Liu
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? *