Fredrik is right, ChatFactory doesn't have sendLine as a method b/c it
doesn't inherit it from ClientFactory. The code: protocol = ChatClient
does do anything within ChatFactory except set the variable. Try out
these.

from twisted.protocols.basic import LineReceiver, LineReceiver.sendLine

or change class ChatFactory(ClientFactory) --- to:

class ChatFactory(ClientFactory, LineReceiver):

or tell ChatFactory that sendLine comes from LineReceiver --

class ChatFactory(ClientFactory):
    protocol = ChatClient

    def clientConnectionFailed(self, connector, reason):
        reactor.stop()

    def clientConnectionLost(self, connector, reason):
        reactor.stop()

    def sendMessage(self):
        self.LineReceiver.sendLine("Test")

I'm pretty sure that those should work.

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

Reply via email to