<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I've got a simple little chat server set up that people can telnet into.&nbsp; The code is as follows:<br><br>----------<br><br>from twisted.internet import reactor<br>from twisted.internet.protocol import ServerFactory <br>from twisted.protocols.basic import LineOnlyReceiver <br>import threading<br><br>class ChatProtocol(LineOnlyReceiver): <br><br>&nbsp;&nbsp;&nbsp; name = "" <br><br>&nbsp;&nbsp;&nbsp; def getName(self): <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if self.name!="": <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return self.name <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return self.transport.getPeer().host <br><br>&nbsp;&nbsp;&nbsp; def connectionMade(self): <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "New connection from "+self.getName() &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 self.sendLine("Welcome to the chat.\r\n/quit to quit.") <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.factory.sendMessageToAllClients(self.getName()+" joined the chat.") <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.factory.clientProtocols.append(self)<br><br>&nbsp;&nbsp;&nbsp; def connectionLost(self, reason): <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "Lost connection from "+self.getName() <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.factory.clientProtocols.remove(self) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.factory.sendMessageToAllClients(self.getName()+" disconnected.") <br><br>&nbsp;&nbsp;&nbsp; def lineReceived(self, line): <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if line=="/quit": <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.transport.loseConnection() <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:
 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.factory.sendMessageToAllClients(self.getName()+": "+line) <br><br>&nbsp;&nbsp;&nbsp; def sendLine(self, line): <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.transport.write(line+"\r\n") <br><br>class ChatProtocolFactory(ServerFactory): <br><br>&nbsp;&nbsp;&nbsp; protocol = ChatProtocol <br><br>&nbsp;&nbsp;&nbsp; def __init__(self): <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.clientProtocols = [] <br><br>&nbsp;&nbsp;&nbsp; def sendMessageToAllClients(self, mesg): <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for client in self.clientProtocols:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client.sendLine(mesg) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br>def Test():<br>&nbsp;&nbsp;&nbsp; global test<br>&nbsp;&nbsp;&nbsp; factory.sendMessageToAllClients('Hey.')<br>&nbsp;&nbsp;&nbsp; test = threading.Timer(1.0,
 Test)<br>&nbsp;&nbsp;&nbsp; test.start()<br>test = threading.Timer(1.0, Test)<br>test.start()<br><br>print "Starting Server"<br>factory = ChatProtocolFactory()<br>reactor.listenTCP(3009, factory)<br>reactor.run()<br><br>----------<br><br>The
problem is that last def, "def Test()".&nbsp; It should send the line "Hey."
to all connected users every second.&nbsp; It does that - however, the
message only sends through if the client is typing or has entered a
line.&nbsp; So, if a client is idle for 30 seconds, then starts typing, he
will receive "Hey." 30 times in a row - one for each second he was idle.<br><br>Is there any way to get this to send the message and have it show up for a client even when they're idle?</td></tr></table>