I Had also tried this with no luck - as it just doesn't work at all:

require 'socket'
require 'thread'
 
sock = TCPSocket.new('ancient.anguish.org',2222)
$stdout.sync = true
 
t1 = Thread.new do
loop do  
  while line = gets
      sock.puts line
      break if /^quit/ =~ line
   end
end
end
 
t2 = Thread.new do
   loop do 
      ch = sock.recv(1)
      putc ch
   end
end
 
t1.join

-----Original Message-----
From: Brian Candler [mailto:B.Candler / pobox.com] 
Sent: Friday, July 04, 2003 4:46 PM
To: ruby-talk ML
Subject: Re: Stuck with Telnet still

On Fri, Jul 04, 2003 at 11:23:48PM +0900, Kingsley Hendrickse wrote:
> I am still stuck with this telnet client :(
> 
> I fyou copy and paste this code - and type guest after it runs - the
intro 
> text pops up which is great and you can sit and watch the happenings
on 
> the
> mud - i.e. somebody does something etc. But you can't type anything.

Fairly understandable, since you're only accepting one line from the
keyboard before that thread terminates:

> t1 = Thread.new do
> if line = gets
> sock.write line
> end
> end

Regards,

Brian.