[Twisted-Python] Newbie question about writing a client

orbitz at ezabel.com orbitz at ezabel.com
Tue May 25 14:02:25 EDT 2004

There are several ways. You can make the string global (probably not what you
want).  Or you can make it part of the Protocol class, and set it during the
buildProtocol method in yoru factory. Or make it part of your factory and have
the protocol use that.  To do the last you coudl do something like:

f = EchoFactory()
f.sayWhat = 'This is what I want to say'
reactor.connectTCP(..., f)

Then your protocol can do:
def connectionMade(..):

Hope that helps.

On Tue, 25 May 2004 12:12:43 +0300
"Anuj Seth" <ANUJS at Amdocs.com> wrote:

> Hi,
> The echo client in doc/examples sends a  hardcoded string from the call back
> "connectionMade". How can i change it to send any string produced by some
> other source ? For e.g., if i want to let the user enter some string and then
> send it to the echo server and then print the result back.
> Thanks for any pointers,
> Anuj.

More information about the Twisted-Python mailing list