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.

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.

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

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)?

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

Greg

On Fri, Apr 10, 2009 at 12:06 PM, Jean-Paul Calderone
<exar...@divmod.com> wrote:
> On Thu, 9 Apr 2009 02:34:23 -0400, Greg Taylor <gtay...@clemson.edu> wrote:
>>
>> 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.
>
> Threading generally isn't the way to do networking with Twisted.  In fact,
> Twisted is almost wholly geared toward avoiding exactly that.
>
>> From your example, it appears as though you've figured out how to do basic
>
> client setup.  What you're missing is how to use the connection once it
> is established.  You need to be thinking of your program in terms of events.
>
>> [snip]
>>
>> I've seen mention of something like:
>> p = reactor.buildProtocol()
>> p.sendLine('blah\n')
>
> You can't really do this.  Instead, it seems that since you want to send
> a line once the connection is established, you should be putting code into
> the event handler for "connection is established".  Your example code
> already defined behavior for this event, in fact - but you only put a
> print statement into it.  Try expanding your `connectionMade´ method to
> do the other things you want to happen at connection setup time.
>
> Jean-Paul
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



-- 
Greg Taylor
Clemson University, Class of 2009
Cell: (864) 888-7964
http://gc-taylor.com

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to