<div dir="ltr"><br>I have a question that could well belong to Twisted or could be directly related to Python.<br><br>My problem, as the other is related to the disconnection process in Twisted. As I read on this , if I want to I have to perform the following steps:<br><br>1-The server must stop listening.<br>2-The client connection must disconnect.<br>3-The server connection must disconnect.<br><br>According to what I read on the previous page to make the first step would have to run the stopListening method.<br><br>In the example mentioned in the web all actions are performed in the same script. Making it easy to access the different variables and methods.<br><br>For me I have a server and a client are in different files and different locations.<br><br>I have a function that creates a server, and assigns a protocol and want, from the client protocol in another file, make an AMP call to a method for stop the connector.<br><br>The call AMP calls the SendMsg command.<br><br><i>class TESTServer(protocol.Protocol):<br><br>    factory = None<br>    sUsername = ""<br>    credProto = None<br>    bGSuser = None<br>    slot = None<br>"""<br>Here was uninteresting code.<br>"""<br>            #   upwards=self.bGSuser, forwarded=True, tx_timestamp=iTimestamp,\<br>            #    message=sMsg)<br><br>        log.msg("self.connector")<br>        log.msg(self.connector)<br><br>        return {'bResult': True}<br>    SendMsg.responder(vSendMsg)<br><br>    def _testfunction(self):<br>        logger = logging.getLogger('server')<br><br>        log.startLogging(sys.stdout)<br><br>        pf = CredAMPServerFactory()<br><br>        sslContext = ssl.DefaultOpenSSLContextFactory('key/server.pem',\<br>     'key/public.pem',)<br><br>        self.connector = reactor.listenSSL(1234, pf, contextFactory = sslContext,)<br><br>        log.msg('Server running...')<br>        reactor.run()<br><br>if __name__ == '__main__':<br>    TESTServer()._testfunction()<br></i><br>The class CredAMPServerFactory assign the corresponding protocol.<br><br><i>class CredAMPServerFactory(ServerFactory):<br><br>    """<br>    Server factory useful for creating L{CredReceiver} and L{SATNETServer} instances.<br><br>    This factory takes care of associating a L{Portal} with the L{CredReceiver}<br>    instances it creates. If the login is succesfully achieved, a L{SATNETServer}<br>    instance is also created.<br>    """<br>    protocol = CredReceiver</i><br><br>In the "CredReceiver" class I have a call that assigns the protocol to the TestServer class. I do this to make calls using the AMP method "Responder".<br><br><i>        self.protocol = SATNETServer</i><br><br>My problem is that when I make the call the program responds with an error indicating that the connector doesn't belong to CredReceiver attribute object.<br><br><i>  File "/home/sgongar/Dev/protocol/server_amp.py", line 248, in vSendMsg<br>    log.msg(self.connector)<br>exceptions.AttributeError: 'CredReceiver' object has no attribute 'connector'</i><br><br>How could I do this? Does anyone know of a similar example of that may take note?<br><br>Thank you.</div>