sybrenUSE at YOURthirdtower.com.imagination
Fri Dec 9 16:50:49 CET 2005
Yves Glodt enlightened us with:
> In detail I need a daemon on my central server which e.g. which in a
> loop pings (not really ping but you know what I mean) each 20
> seconds one of the clients.
You probably mean "really a ping, just not an ICMP echo request".
> The only thing the client has to do is to accept the connection.
> (optionally sending back some bytes). If it refuses it is assumed to
> be offline.
Ok, fair enough.
> My central server, and this is important, should have a short
> timeout. If one client does not respond because it's offline, after
> max. 10 seconds the central server should continue with the next
I'd write a single function that pings a client and waits for a
response/timeout. It then should return True if the client is online,
and False if it is offline. You can then use a list of clients and the
filter() function, to retrieve a list of online clients.
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
More information about the Python-list