[Twisted-Python] Two-way telnet client problem

Greg Taylor gtaylor at clemson.edu
Thu Apr 9 02:34:23 EDT 2009


Hello all,

I'm still pretty new with Twisted, so the documentation is a little
bit cryptic and strange to wade through. I'm writing a MUD server that
I'd like to add InterMUD Protocol (IMC) to. This basically allows any
of the games running the MUD server to connect to an IMC server that
lets players from other games talk to one another. I'm thinking I'll
create another thread and run the IMC client from there so as to not
block the main server thread.

I've started tinkering with how to get the IMC client connected and
able to send and receive, but I'm hitting a problem. If you look at my
pasted example at http://python.pastebin.com/m155730ed you will see at
the end that once the reactor is running, I _think_ this blocks things
up for this thread. This is just fine, I assumed it'd be the case.
However, let's go back to my main MUD server's thread for a moment.
How would I tell the IMC client to send a line of text now? I assume
it'd be something to do with the factory or reactor objects, but I'm
just not sure.

I've seen mention of something like:
p = reactor.buildProtocol()
p.sendLine('blah\n')

But can't quite seem to piece it together. I'd really love to figure
this out, as it'd do a lot for my game. I may be doing this horribly
wrong, any direction would be great.

Greg




More information about the Twisted-Python mailing list