Telnet from ruby gives 'waitfor' error


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

require ‘net/telnet’

tn ={}) { |str| print str }
tn.login(“db2admin”, “db2admin”) { |str| print str }
tn.cmd(“date”) { |str| print str }


Trying localhost…
Connected to localhost.
Welcome to Microsoft Telnet Service

login: db2admin
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:incmd’
from c:/ruby/lib/ruby/1.8/net/telnet.rb:722:in `login’
from telnet.rb:4

Thank You