hello,
i am reposting this hoping someone will be able to assist. the following
script works but not all the time. i can monitor the port the script
connects to and i can see that some of the transmitted data is lost; ie.
'omshow trk trafhr dogdid' becomes 'omshw trk trafhr dogdid'
is there a way to slow down the transmission of characters or some other
methold to assure that what is sent is received?
my goal is to login, issue a command, collect output until the '>' character
is received and then logout.
thanks
# ------
#!perl -w
use Net::Telnet;
$t = new Net::Telnet(Host => '10.16.15.4', Port => '2008',
Timeout => 40);
$ok = $t->open();
$t->input_log;
if ($ok) {
$ok = $t->waitfor(String => '$'); print "\$";
$ok = $t->break;
$ok = $t->break;
$ok = $t->waitfor(String => '?'); print "\?";
if ($ok) {
$t->print("login\n"); print "login\n";
$ok = $t->waitfor(String => ">"); print ">";
$t->print("hcir\n"); print "user\n";
$ok = $t->waitfor(String => "\n>"); print ">";
$t->print("pass\n"); print "pass\n";
$ok = $t->waitfor(String => "\n>"); print ">";
$prev = $t->input_record_separator(">");
$t->print("omshow trk trafhr dogdid\n");
print "omshow trk trafh dogdid\n";
@buf = $t->getlines(Timeout => 850);
$ok = $t->print(" logout\n"); print "logout\n";
}
}
$t->input_record_separator($prev);
$ok = $t->close;
foreach $ln (@buf) {
print "$ln\n";
}
# ------
-- hcir
mailto:[EMAIL PROTECTED]
Made with a Mac!