Hi
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. The
aim is to have something listening constantly to the server to print to
the screen what is going on and have the ability to enter commands like
sit, walk etc. I can only get one or the other at the moment - this code
lets you watch but not type anything - if I change the ch =- sock.recv(1)
to ch = sock.read(1) and remove the loop and use while instead - I can
type stuff and watch the response - but then I have to keep hittinf a key
to see the server responses that are happening from other players and also
it is formatted badly and brings up the text in globs rather than the nice
way it loks when using sock.recv(1)
···
require 'socket’
require ‘thread’
sock = TCPSocket.new(‘ancient.anguish.org’,2222) # login name: guest (no
password needed)
t1 = Thread.new do
if line = gets
sock.write line
end
end
t2 = Thread.new do
loop do
ch = sock.recv(1)
putc ch
end
end
t1.join
t2.join
Thanks
Kingsley