Questions - partly newbie

hard.one Software GmbH - Martin Peter Hanke mphanke at hardone-it.ch
Mon Jun 29 13:09:30 CEST 2015


Hi all

I'm new to event loops and am wondering about a couple of things...
Maybe somebody will clarify the questions for me. I'm using ev++ for 
implementation, if this is of interest.

I'm implementing a TCP-Socket Server on Linux to which a large number of 
embedded devices is connecting and reporting status every 10-60sec.

The current architecture spawns a thread for the server, accepting 
connections in an own ev::default_loop.
The server there is 2x ev:signal and 1x ev::io(ev::READ) for accepting 
connections.

On accepting the client gets it's own thread with an ev::dynamic_loop.
For the client I'm using 2x ev::io (1x ev::READ, 1x ev::WRITE), 1x 
ev::timer, 1x ev::async for stopping.

1. When running an event loop with multiple watchers, per iteration only 
one watcher is called - is this intended or is my implementation wrong?

2. Having the ev::timer running, at some point the ev::io watchers stop 
working. are the watcher excluding each other?

3. Sometimes the latency is extremly high, when accepting connections. I 
can't really find a reason for this. Any hints?

4. Is there any known difference between ev++ and ev I should be caring 
about?

I started with this examples as a base for the implementation:

http://codefundas.blogspot.ch/2010/09/create-tcp-echo-server-using-libev.html

https://github.com/coolaj86/libev-examples/blob/master/src/unix-echo-server.c

https://gist.github.com/koblas/3364414

Thanks for your help and patience in advance!

Martin



More information about the libev mailing list