I&#39;ve been using xmlstream for quite sometime now and I noticed one such problem where my server doesn&#39;t detect clients that went to hardware shutdown without closing the socket. I also reproduced it using a simple twisted TCP server:<br>
<br>#!/usr/bin/python<br>from twisted.internet import protocol<br>from twisted.internet import reactor<br><br>class EchoProtocol(protocol.Protocol):<br>&nbsp;&nbsp;&nbsp; def __init__(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pass<br><br>&nbsp;&nbsp;&nbsp; def connectionMade(self):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &quot;Client Connected Detected!&quot;<br><br>&nbsp;&nbsp;&nbsp; def connectionLost(self, reason):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &quot;Client Connection Lost!&quot;<br><br>&nbsp;&nbsp;&nbsp; def dataReceived(self, data):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.transport.write(data)<br>
<br><br>factory = protocol.Factory()<br>factory.protocol = EchoProtocol<br>reactor.listenTCP(8000, factory)<br>reactor.run()<br><br>Using a different machine, telnet to the echo server and then shut down the computer (without exiting telnet). It seems that the connectionLost function doesn&#39;t get called. I even had an XMPP account appeared online on our XMPP server for almost three days even though I shut down the PC hosting my client. Should we implement a Hearbeat functionality? Thank you in advance!<br>
<br clear="all">Alvin Delagon<br><br>-- <br><a href="http://www.alvinatorsplayground.blogspot.com/">http://www.alvinatorsplayground.blogspot.com/</a>