I am afraid there is no way to list the objects watched by an event base, let alone list only the established connections and their status. You could try to patch libevent for your needs, or you can keep score out of the connections accepted outside of libevent.
Libevent: get list of accepted connections
Question
I'm working on a multi-threaded client-server application designed for usage in the enterprise internal network. I use libevent for asynchronous I/O (several pthreads with one evconnlistener/bufferevent object per thread) and OpenSSL for cryptography.
Now I need to determine mechanism of monitoring of the established connections (for example, check on the server side if client got down or exceeds some timeouts). And it seems like libevent 2.0.21 does not provide any API to get list of active connections.
I am ready to write global data structure (list of client IP's for instance), but may be there is a method for this purposes, hidden deep inside libevent API?
Thanks a lot.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow