Where are the connections stored, are they in a list, how to I access them?
I have a (-messy-) program that will allow the users to set there name and when they send input to the server it will come up with "Received: Blah from username" but I would like to send that to all of the people who are connected.
Also, So that they can shut the connection to them.
from twisted.internet import reactor, protocol PORT = 6661 class User(protocol.Protocol): connectionstat = 1 name = "" def connectionMade(self): self.transport.write("Hello, What is your name?") def dataReceived(self, data): if self.connectionstat == 1: self.name = data self.connectionstat = 2 else: print "Received: " + data.rstrip('\n') + " from " + self.name self.transport.write("You Sent: " + data) def main(): factory = protocol.ServerFactory() factory.protocol = User reactor.listenTCP(PORT,factory) print "Running Echo..." reactor.run() if __name__ == '__main__': main()