Loading ...
Sorry, an error occurred while loading the content.

Need help with Telnet

Expand Messages
  • Bobby Jafari
    Hi All, I doing the following: sub SendSCPI { my $errMode = return ; my $timeOut = 10 ; my ($result) = 0 ; my ($ScpiString) = @_; my $telnet =
    Message 1 of 1 , Sep 21, 2005
    • 0 Attachment
      Hi All,

      I doing the following:

      sub SendSCPI
      {
      my $errMode = "return";
      my $timeOut = "10";
      my ($result) = "0";
      my ($ScpiString) = @_;

      my $telnet = new Net::Telnet ( Port => "$Port",
      Timeout => "$timeOut",
      Errmode => "$errMode");

      ($result) = $telnet -> open("$Host") or return "FAILED to connect to
      Tester";
      ($result) = $telnet -> print("$ScpiString\n") or return "FAILED";
      ($result) = $telnet -> get();

      if (($EchoState =~ /ON/i) or ($EchoState =~ /1/i))
      {
      #I get warning for the following print statement
      print "$ScpiString $result\n";
      }
      if (($Loging =~ /ON/i) or ($Loging =~ /0/i))
      {
      open ( FILEHANDLE, ">>$TestName.log") or return "Failed, Cannot
      open TestFile.log";
      #I get warning for the following print statement
      print ( FILEHANDLE "$ScpiString $result\n" );
      flock ( FILEHANDLE, 2);
      seek ( FILEHANDLE, 0, 2);
      close ( FILEHANDLE );
      }
      # Telnet session doesn't close properly
      my ($retuenValue) = $result;
      $result = $telnet -> close;
      return $retuenValue;
      }

      Problem 1: The telnet session doesn't seem to close. Ie, the longer my
      timeout, the longer it takes for sun to complete.
      Problem 2: I get a warning that in the lines that I have used print
      statement for variable: $ScpiString and $result (Don't know which one is
      causing the compiler to Gag)
      Use of uninitialized value in concatenation (.) or string at
      C:/Perl/lib/senetasLIB.pl line xx.



      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.