Seite 1 von 1

Asynchat Server offline erkennen?

Verfasst: Montag 4. August 2008, 12:13
von Damaskus
Hi,
gibt es eine Funktion die von asyncor bzw. asnychat (als Client) aufgerufen wird wenn die Verbindung zum Server nicht hergestellt werden kann?

Ich bekomme dann die Ausgabe "warning: unhandled exception" aber ein Abfangen mit handle_error ist anscheinend nicht möglich.

Gruß
Damaskus

Verfasst: Montag 4. August 2008, 14:45
von Damaskus
Die Antwort könnte sein:

Code: Alles auswählen

    def handle_expt(self):
        print = "Server offline!"
        self.close() # Beendet den Client
richtig? :roll:

Gruß
Damaskus

Verfasst: Montag 4. August 2008, 18:17
von Trundle
Könnte, muss aber nicht. Ich hätte gesagt, dass es abhängig vom Betriebssystem ist (zumindest lässt die Dokumentation zu asyncore und select darauf schließen: "Called when there is out of band (OOB) data for a socket connection. This will almost never happen, as OOB is tenuously supported and rarely used." bzw. "wait for an ``exceptional condition`` (see the manual page for what your system considers such a condition)").