Pierre Barbier de Reuille wrote:
> Hello there !
>
> I was trying to code a scriptable MUD client (following the RubyQuiz
> challenge). For the moment, I implemented a scriptable telnet which
> works fine with my mail server and also with the test server provided
> by James Edward Gray II on the RubyQuiz website. However, when I
> tried it
> on a real MUD server, it just stopped receiving data after a few lines
> (I tested it on imperian.com:23). The connection is not lost however,
> as
> I can send commands (simple: if you can send "3", it will exit your
> session :) ).
>
> I join my code here, all the connection stuff are in the two methods
> "connect" and "idle" of the MUD class.

The first changes I'd do are to use the block form of File.open, use
synchronized IO during testing and print out any exceptions you catch in
#idle.  At the moment the script silently terminates if there is an
exception with socket io and you never learn what went wrong (timeout for
example).

Regards

    robert