I created a test script with the relevant code for this. The latest iteration of that code is seen below, with IP addresses/usernames/passwords changed for public sharing...

#!C:/Perl64/bin/perl.exe use Control::CLI; my $mrvip = "1.2.6.4"; my $mrvuser = "mrvuser"; my $mrvpass = "mrvpass"; my $mrvport = "5"; my $mrvenpass = "mrvenpass"; my $oauser = "oauser"; my $oapass = "oapass"; my $bladeuser = "bladeuser"; my $bladepass = "bladepass"; my $obj; my $ok; my $output; my @blades = qw/1 2 3 4 5 6/; my @switches = qw/1 2/; $obj = new Control::CLI ( Use => 'SSH', Timeout => 10800, Input_log => "mrv_oa.input.log", Output_log => "mrv_oa.output.log", Dump_log => "mrv_oa.dump.log", ); $ok = $obj->connect( Host => $mrvip, Username => $mrvuser, Password => + $mrvpass,); $ok = $obj->login( Password => $mrvpass,); $output = $obj->cmd(""); my $oaconn = $obj->cmd("conn port asy $mrvport\n"); if ( $oaconn =~ m/.*Unable to connect to port.*/s ) { $output = $obj->cmd("en"); $output = $obj->cmd("$mrvenpass"); $output = $obj->cmd("logout port asy $mrvport"); $oaconn = $obj->cmd("conn port asy $mrvport"); } $output = $obj->cmd(""); my $oaloginu = $obj->cmd("$oauser"); my $oaloginp = $obj->cmd("$oapass"); foreach my $blade (<@blades>) { print "Connecting To Blade $blade...\n"; my $bladeconn = $obj->cmd("connect server serial $blade\n"); if ($bladeconn =~ m/service is unavailable/s ) { next; } my $port = $obj->port; if (defined($port)) { print " Connected To Blade $blade!\n"; my $bladexit1 = $obj->cmd("\033\050"); } else { print " Not Connected To Blade $blade...\n"; } } foreach my $switch (<@switches>) { print "Connecting To Switch $switch...\n"; my $bladeconn = $obj->cmd("connect interconnect $switch\n"); my $port = $obj->port; if (defined($port)) { print " Connected To Switch $switch!\n"; my $switchexit = $obj->print("\037"); # <== PROBLEM $output = $obj->put("D"); # <== PROBLEM } else { print " Not Connected To Switch $switch...\n"; } } #$output = $obj->cmd("quit"); #$output = $obj->print("\032"); #$output = $obj->print("\145"); #$output = $obj->cmd("e");

The worst part is, in the dump log, I can see it sending the HEX to the remote machine, but it does not respond properly to the code (in this case, the "1f" 2 lines from bottom)...

... redacted for readability... < 0x00020: 0d 0a 45 73 63 61 70 65 20 63 68 61 72 61 63 74 ..Escap +e charact < 0x00000: 65 72 20 69 73 20 27 3c 43 74 72 6c 3e 5f 27 20 er is ' +<Ctrl>_' < 0x00010: 28 43 6f 6e 74 72 6f 6c 20 2b 20 53 68 69 66 74 (Contro +l + Shift < 0x00020: 20 2b 20 55 6e 64 65 72 73 63 6f 72 65 29 0d 0d + Unde +rscore).. < 0x00000: 0a 0d 0a 50 72 65 73 73 20 5b 45 6e 74 65 72 5d ...Pres +s [Enter] < 0x00010: 20 74 6f 20 64 69 73 70 6c 61 79 20 74 68 65 20 to dis +play the < 0x00020: 73 77 69 74 63 68 20 63 6f 6e 73 6f 6c 65 3a 20 switch +console: > 0x00000: 1f 0a .. > 0x00000: 44 D

In reply to Re^2: Control:CLI or Net::SSH2 - Send <ctrl>_ by ImJustAFriend
in thread Control:CLI or Net::SSH2 - Send <ctrl>_ by ImJustAFriend

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.