[Twisted-Python] Two-way telnet client problem

Jean-Paul Calderone exarkun at divmod.com
Sat Apr 11 11:21:28 EDT 2009


On Fri, 10 Apr 2009 13:10:28 -0400, Greg Taylor <gtaylor at clemson.edu> wrote:
>I guess what I'm getting confused about is how to get my listen server
>(MUD server) talking to this IMC client connection. Let's say one of
>my player wants to send a message over the IMC (client) connection.
>This is done by telnetting into the MUD server and entering a command
>like: imcmessage "hello". So I've got a reactor serving up my MUD
>server process, and I'm not sure how this IMC client plugs in.

This sounds a lot like this FAQ:

http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions#HowdoImakeinputononeconnectionresultinoutputonanother

>
>I guess I need to create some kind of queue that the IMC
>ConnectionMade checks periodically and executes if I can't directly
>get the MUD server talking to the IMCProtocol object.

Fortunately, you can make them talk directly. :)  No need for a queue.

>Also, do I need to do anything special to prevent blocking?

As long as you're using Twisted APIs for dealing with the networking,
no - those won't block.

>Do I use two separate reactors or should the IMC connection be using
>the same reactor or process group as the MUD server (listen server)?

There's always exactly one reactor in a Twisted app.

>Thanks for your help. I'm sure this will be really simple to do once I
>figure out how to do this.

Hope this helps,

Jean-Paul




More information about the Twisted-Python mailing list