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

Thank You
Dinesh