Callback help client / server

Chris <[email protected]>
Newsgroups gmane.comp.python.twisted.web
Message-ID <[email protected]>
from twisted.internet.protocol import Protocol, ClientFactory
from sys import stdout
from twisted.internet import reactor

from misc.configobj import ConfigObj
from misc.get_keywords import get_keywords
import time
import Queue
from bing_runner import msn
import simplejson as json
import base64
from time import sleep

class ses(object):
    def __init__(self,client):
        print "INITIATED"
        self.client = client
        self.main()
              
    def act_on(self,msg):
        print "WE GOT IT BACK"
        print msg   
    def main(self):
            print "Downloading List"
            self.client.sendMessage("get_data\r\n").addCallback(self.act_on)

class Echo(Protocol):
    def connectionMade(self):
        print "Connected To Server"
        s = ses(self)

    def sendMessage(self, msg):
        print "Sending: %s"%msg
        self.transport.write(msg)
        d = defer.Deferred()
        sleep(5)      

    def dataReceived(self, data):
        stdout.write(data)
        self.s.server_data = data
        return encoded

class EchoClientFactory(ClientFactory):
    protocol = Protocol
    def startedConnecting(self, connector):
        print 'Started to connect.'
   
    def buildProtocol(self, addr):
        print 'Connected.'
        return Echo();
    def clientConnectionLost(self, connector, reason):
        print 'Lost connection.  Reason:', reason
   
    def clientConnectionFailed(self, connector, reason):
        print 'Connection failed. Reason:', reason
    #def clientConnectionLost(self, connector, reason):
        #connector.connect()

# this connects the protocol to a server runing on port 8000
def main():
    f = EchoClientFactory()
    f.protocol = Echo
    reactor.connectTCP("localhost", 8000, f)
    reactor.run()


# this only runs if the module was *not* imported
if __name__ == '__main__':
    main()

I am trying to figure out a way so I can access the datareceived outside of the Echo Class so I can run operations on the data received. Fairly new to twisted. Any help is appreciated
 		 	   		  
_________________________________________________________________
Eligible CDN College & University students can upgrade to Windows 7 before Jan 3 for only $39.99. Upgrade now!
http://go.microsoft.com/?linkid=9691819

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.