libev TCP echo server example?

Brandon Black blblack at gmail.com
Sun Mar 28 03:55:12 CEST 2010


On Sat, Mar 27, 2010 at 3:38 PM, Marc Lehmann <schmorp at schmorp.de> wrote:
> On Sat, Mar 27, 2010 at 07:21:52PM +0000, Chris Dew <cmsdew at googlemail.com> wrote:
>> // Lots of globals, what's the best way to get rid of these?
>
> put them into a struct, maybe together with the watcher(s), and put it's
> address intot eh data pointer (or or some othe rtechnique described in the
> libev manual).
>

If you want a more complex/complete example, you can look at some of
my code over here:

http://code.google.com/p/gdnsd/source/browse/trunk/gdnsd/dnsio_tcp.c

There be many dragons in this code, but you can see the basic
per-thread/per-conn data structures and how they're passed around and
how the callbacks are set up with timeouts and so-on.

-- Brandon



More information about the libev mailing list