logging.info("Connection lost") self.factory.clients.remove(self) self.factory.ips.remove(self.ip) def dataReceived(self, data): logging.debug("Spreading "+str(len(data))+" bytes to "+str(len(self.factory.clients))+" clients") for p in self.factory.clients: if p != self: p.transport.write(data) clients = [] ips = [] f_tcp = Factory() f_tcp.protocol = Client f_tcp.clients = clients f_tcp.ips = ips from twisted.python import log observer = log.PythonLoggingObserver() observer.start() from twisted.application import internet, service from twisted.internet import reactor application = service.Application("orpend") # create the Application tcpService = internet.TCPServer(24142, f_tcp) # create the service tcpService.setServiceParent(application)
def connectionLost(self, reason): logging.info("Connection lost") self.factory.clients.remove(self) self.factory.ips.remove(self.ip) def dataReceived(self, data): logging.debug("Spreading " + str(len(data)) + " bytes to " + str(len(self.factory.clients)) + " clients") for p in self.factory.clients: if p != self: p.transport.write(data) clients = [] ips = [] f_tcp = Factory() f_tcp.protocol = Client f_tcp.clients = clients f_tcp.ips = ips from twisted.python import log observer = log.PythonLoggingObserver() observer.start() from twisted.application import internet, service from twisted.internet import reactor application = service.Application("orpend") # create the Application tcpService = internet.TCPServer(24142, f_tcp) # create the service tcpService.setServiceParent(application)