Checking whether an async* dispatcher is "alive"
Sean 'Shaleh' Perry
shalehperry at attbi.com
Sat Apr 13 10:46:22 EDT 2002
On 13-Apr-2002 Magnus Lie Hetland wrote:
> In a server I'm working on, I need to check whether an asynchat
> dispatcher is still connected, i.e. whether I can send it data. I've
> tried to use try/except (with socket.error) but since async* catches
> that itself, It's no good.
>
> Are there any methods/attributes that indicate whether I can send data
> on a dispatcher? (Possibly some method/attribute on its socket
> object?)
>
The usual tactic is to send the smallest possible operation and see if you get
a response aka "heartbeating". Several protocols have a noop command you can
send that the server acknowledges.
More information about the Python-list
mailing list