Forum: Ruby Telnet from ruby gives 'waitfor' error...

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dinesh U. (Guest)
on 2006-06-02 08:20
Hi all,

I was trying to use "Telnet" from ruby as per the doc and below is the
sample/simple program, when we execute this, i get the below output. The
line 'login:db2admin' displays immediately and it pauses for sometime in
the 'password:' and after few seconds i get something like 'waitfor'..


Not sure what should be the problem and how should we correct it? Any
ideas?
*************************************************************
require 'net/telnet'

tn = Net::Telnet.new({})     { |str| print str }
tn.login("db2admin", "db2admin")  { |str| print str }
tn.cmd("date")  { |str| print str }
*************************************************************

OUTPUT
------
Trying localhost...
Connected to localhost.
Welcome to Microsoft Telnet Service

login: db2admin
password:
c:/ruby/lib/ruby/1.8/net/telnet.rb:551:in `waitfor': timed out while w
aiting for more data (Timeout::Error)
        from c:/ruby/lib/ruby/1.8/net/telnet.rb:678:in `cmd'
        from c:/ruby/lib/ruby/1.8/net/telnet.rb:722:in `login'
        from telnet.rb:4


Thank You
Dinesh
This topic is locked and can not be replied to.