[Twisted-Python] Accessing ClientFactory methods?

Don Hiatt don at motorola.com
Mon Jul 14 13:53:38 EDT 2003


Sorry for the stupid questiong, but... :)

Following the client howto I created a simple client
using a ClientFactory, like this:

class echo(Protocol):
	def sendMsg(self, data):
		print "sending", data
		self.transport.write(data)

	def dataReceived(self, data):
		...
		...
		msg = "foo"
		self.sendMsg(foo)


So this works fine, however, how can I access the echo.sendMsg
method from outside the class instance? I can't just use echo.sendMsg(..)
because I never seem to have a "handle" for it. Sorry for such a stupid
namespace issue, but I am just learning. :) (I have tried various ways
to get at the method but either get "sendMsg is unbounded" or that the
method requires an instance to it self). 

As always, thank you so much for your time. 

Cheers,

don





More information about the Twisted-Python mailing list