Start New Discussion within our Software Development Community

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:
   = data
            self.connectionstat = 2
            print "Received: " + data.rstrip('\n') + " from " +
            self.transport.write("You Sent: " + data)

def main():
    factory = protocol.ServerFactory()
    factory.protocol = User
    print "Running Echo..."

if __name__ == '__main__':


This question has already been answered. Start a new discussion instead.