On Mon, May 18, 2009 at 07:10:47PM +0200, q6Yr7e0o nIJDVMjC wrote: > Hi > > > > For one example of how to use the 2.0.1-alpha API, you could have a > > look at chapter 1 of > > ? ? ?http://www.wangafu.net/~nickm/libevent-book/ . > > Would it be possible to link that book on > http://monkey.org/~provos/libevent/ ? I've long googled for such > reference material but didn't find any
Sorry! We'll put it up eventually (probably in the next week or two). It hasn't been called an official thing yet because it is very much a work in progress. (For instance, I haven't tried to compile any of the examples in the reference section yet. Also, some of the stuff that it documents only exists in Subversion.) [...] > > I hope we can get Libevent 2.0.2-alpha released this week. ?Until > > then, you can use subversion to fetch the latest code from the > > repository at > > > > ? https://levent.svn.sourceforge.net/svnroot/levent/trunk/libevent > > One think I don't understand about buffer events (I haven't read the > source yet): If i call > > struct evbuffer *input = bufferevent_get_input(bev); > > and then read the contents of input by calling bufferevent_read, is > there a way to not remove the data from the input buffer? First, you probably wouldn't grab the input evbuffer if you were using bufferevent_read(): bufferevent_read(be, b, n) is just an alias for evbuffer_remove(bufferevent_get_input(be), b, n). In 2.0.1-alpha, you can see the N bytes at the start of an evbuffer without removing them by calling evbuffer_pullup(). It isn't very efficient, though: see the documentation. The 2.0.2-alpha release will add an evbuffer_peek function to see the bytes in the evbuffer without copying them out, and without rearranging the internals of the evbuffer. If you're trying to reduce byte copies, it may do what you want. > Perhaps I > just want to look at it if it's enought to parse and if not wait for > another call of my echo_read_cb? Or do I have to read the input buffer > into another buffer to preserve it? > > If I have to read/write the buffers into each other, are the contents > copied each time? If you use evbuffer_add_buffer(), the contents aren't copied. If you use evbuffer_remove_buffer(), the contents are only copied to the extent they do not fall cleanly on a chunk boundary. yrs, -- Nick _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users