[Twisted-Python] Connection close identifier
Christopher Armstrong
radix at twistedmatrix.com
Wed Apr 7 11:29:29 EDT 2004
Daniel Henrique Debonzi wrote:
> Hi folks,
>
> I have a server-client system where sometimes the server closes the
> connection and sometimes client closes connection.
> In each situation I must do diferent things.
>
> Is there a way to know in connectionLost method who closes the connection??
>
> I have already look in the reason atribute, but it seems to the same in
> both cases.
I don't know if there's a Better Way, but presumably you already know
who closed the connection, because _someone_ is calling loseConnection.
In the code that calls loseConnection, say self.I_closed_the_connection
= True, or something like that, and then you can check for that flag in
connectionLost.
--
Twisted | Christopher Armstrong: International Man of Twistery
Radix | Release Manager, Twisted Project
---------+ http://radix.twistedmatrix.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20040407/afb1c806/attachment.pgp
More information about the Twisted-Python
mailing list