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

Re: [Libevent-users] libevent + bufferevent + IOCP = confused



Thanks Nick.

You know of any projects using buffevents + IOCP succesfully?
I've read about memcached + libevent, but I don't think they use bufferevents.


/Juan

2011/7/3 Nick Mathewson <nickm@xxxxxxxxxxxxx>:
> On Fri, Jul 1, 2011 at 11:26 AM, Juan Pablo Fernandez
> <this.juan@xxxxxxxxx> wrote:
>> Hi,
>>
>> I've been experimenting with libevent on windows. I want to use IOCP,
>> worker threads filling a queue layer in a server application.
>> Bufferevents is a nice fit! And I've written a small server using
>> bufferevents.  However, I'm confused reading the documentation,
>> saying:
>>
>> 1, It's experimental (online book)
>> 2, Back-end is still select-based.
>> 3, Can be used for sending (no mention of receive)
>>
>> ==> What is the "true" status?
>
> It is indeed experimental.
>
> The select-based backend is still used for the event interface
> provided by event_add, event_del, etc.  It turns out that you can't
> emulate that using IOCP, as far as I can tell.[*]  If you want to use
> IOCP, you need to use bufferevents: the bufferevent interface _can_ be
> implemented with IOCP.
>
> And so there's an implementation of it.
>
> To use it, initialize Libevent passing the
> EVENT_BASE_FLAG_STARTUP_IOCP flag in the event_base_config.  This will
> make subsequent calls to bufferevent_socket_new() return an IOCP-based
> bufferevent, and evconnlistener_*new() return IOCP-based listeners.
>
> [*] Some people have in the past tried to implement the event backend
> using IOCP, using a hack where "completing" a zero-length read or
> write indicated that the socket was readable/writable.  When we
> investigated, it turned out that this works for reading, but not for
> writing: sockets whose buffers are too full to write anything will
> still accept a zero-length write and report it as "completed."  If
> there's a way around this, or somebody knows differently, I'd love to
> know about it.
>
> yrs,
> --
> Nick
> ***********************************************************************
> To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> unsubscribe libevent-users    in the body.
>



-- 
//Juan Pablo
Professional Computer Scientist
The Software shall be used for Good, not Evil.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.