Ask a Question related to PERL Miscellaneous, Design and Development.
-
Robert #1
client/server using Net::Telnet fails under certain conditions. Help please
I wrote a server that listens for an input array of 1 or more elements. It
conducts a conditional loop looking for key patterns in array element [0].
Based upon the match the server executes a predetermined function e.g. if
($in[0] =~ /pattern/) { do something }. It works great when I telnet to the
assigned port on the host the server is listening to. That is,
telnet hostname 12000
fs
<execute a df from server>
When I run my client some of the commands work, $shell->print('some
command'), and some don't. I have tried closing the socket and reopening
it, turned on all the error messages I know about, print to the LOG files.
What I have determined is that the call to
open(CMD,"| ps -ef") or print LOG "ps failed $!\n"; fails to either
work (which I doubt since the log file doesn't have any entires for that
failure or the $shell->getlines(); is not receiving any input. Remember, it
works fine when I telnet manually. Any ideas as to why it is failing.
Thanx in advnace.
______END_____
$shell =
Net::Telnet->new(Host=>$host,Port=>$port,Timeout=>60,Errmode=> 'return');
$shell->input_log($logfile);
$shell->dump_log($dumplog);
$fs_array = get_fs(); <<<<<<<<<<<< goes to server to execute and return a
df. Works fine!
($filesystems,$h_lvols) = clean_data($fs_array); <<<<<<<<< Not a
Net::Telnet sub.
$filesys = select_fs($filesystems); <<<<<<<< not a Net::Telnet sub.
($startd,$stopd) = select_dates(); <<<<<<<<<< not a Net::Telnet sub.
begin_extract($extract,$startd,$stopd); <<<<<< Net::Telnet sub. works
when I take out the following while loop and replace with sleep for 40.
$line = $shell->lastline;
print "This is lastline 1 $lastline\n";
$result = $shell->errmsg;
print "Error msg 1 $result\n";
$shell->close();
$shell =
Net::Telnet->new(Host=>$host,Port=>$port,Timeout=>60,Errmode=> 'return');
while (1) {
print "XXX\n";
$shell->print("psef");
@psarray = $shell->getlines(); <<<<<<<<<<<<<< seems to fail here in that
nothing is returned to @psarray.
$line = $shell->lastline;
print "This is lastline 2 $lastline\n";
$result = $shell->errmsg;
print "Error msg 2 $result\n";
chomp(@psarray);
if (grep { /extract/ } @psarray ) {
print "grep match\n";
sleep 5;
} else {
print "last ---*\n";
last;
}
}
Robert Guest
-
Multiple Conditions for Server Control
I have a server control that needs to be rendered upon meeting certain conditions that our HTML people can alter. This works fine if the multiple... -
Flash Webcam client <-> client (not client <-> server<-> client)
Dear Flash Team, supporter and regular mortals (Like myself) I am currently running a IRC chat with mostly webclients connected. We currently offer... -
Recommendations for SSL telnet client - vt220
I'm looking for recommendations for a reliable SSL telnet client with vt220 eumlation. It needs to have customizeable keyboard mapping as well. ... -
Fully featured telnet client for OSX?
I sometimes have to telnet to two or more hosts at one time. What I can do with BetterTelnet is associate colors with a particular terminal, then... -
HELP: Linux telnet smtp server fails, Works from MS Windows
I'm stumped. And I'm not a guru. I think I have a network setup problem on my Linux box, but I'm not sure what to look for. Problem: Trying...



Reply With Quote

