En Wed, 10 Feb 2010 17:13:58 -0300, Jordan Apgar <twistedphr...@gmail.com> escribió:

I'm having some issues connecting to my Socket Server,  I get this
traceback on the sever side:
----------------------------------------
Exception happened during processing of request from ('127.0.0.1',
56404)
Traceback (most recent call last):
  File "/usr/lib/python2.6/SocketServer.py", line 320, in
finish_request
    self.RequestHandlerClass(request, client_address, self)
AttributeError: Negotiator instance has no __call__ method
----------------------------------------


class ServerNegotiator:
    def __init__(self, host, port, hostid, rsa_key, buf = 512):
        negotiator = Negotiator(host, hostid, rsa_key,buf)
        self.server = SocketServer.TCPServer((host, port), negotiator)

You have to pass the *class* of the RequestHandler you want, not an instance. TCPServer will create an instance of such class for every request handled. So you can't (or shouldn't) save permanent info in the handler, like rsa_key. Store all those parameters in the server. From the handler, you may access the server using its .server attribute.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to