Stuck in the middle with Telnet

K

kingsley

Hi

I am trying to write my own telnet client to connect to my favourite
MUD. (http://www.anguish.org/)

I\'m stuck - I can\'t make it login at all ! I don\'t quite understand
the concept.

Do I use tn.cmd(\"mudcommand\") to do pass the commands? Like :

input = gets.chomp #look at tree
tn.cmd(input) {|str| print str} #you look at a tree

here\'s what I have that doesnt work..note - If I just change the login
name (string) to guest and delete the password line - it does log in as
guest (which requires no password).

require \'net/telnet\'

require \'net/telnet\'
tn = Net::Telnet.new(\'Host\' => \'ancient.anguish.org\',
\'Port\' => \'2222\',
\'Timeout\' => 60,
\'Telnetmode\' => true) { |str| print str }

tn.cmd(\"Match\" => \"What is your name: \", \"String\" => \"myname\")
{ |str| print str }
tn.waitfor(\"Match\" => \"Password: \", \"String\" => \"mypassword\") {
|str| print str }

Thanks

btw - I have also tried to make the password command a tn.cmd, tn.write
and tn.print but with no success.

Kingsley
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top