Re: Knowing how many clients are connected to a Proxy

Irmen de Jong <[email protected]>
Newsgroups gmane.comp.python.pyro
Message-ID <[email protected]>
On 8-1-2013 16:02, Pedro Cardoso wrote:
> Hi,
> 
> I have a server (Deamon) running, and I would like to know how many clients (Proxies) I
> have connected to it.
> 
> The objective is to kill a deamon if it is inactive after a long time.
> 
> Pedro

Hello Pedro,

At this time, Pyro hasn't got a public API to do this.
There's an item on the todo list though to add something like this (but until now, it
hasn't really been requested before)

Your best bet now would probably be to override Daemon._handshake in a subclass or
monkeypatch it, and let it track the number of connection handshakes it receives.
There's no way of knowing when a client went away though...

For a multiplexing server you could count the Daemon.transportServer.sockets list, which
contains all active client sockets and the daemon server socket. This makes no sense on
the threadpool server though (it will always only contain the daemon's server socket).

Maybe you can define "inactive daemon" more precisely so that we might think of a
possible other solution to your problem?


Regards
Irmen de Jong




------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.