Hello ElectricCheese,
Welcome to the monastery. Well I want to ask one question, why telnet and not any other alternative? See Best module to execute administrator commands on external operating systems (Linux) for possible alternatives with samples of code. I know the title says Linux but the modules and samples of code should apply on WindowsOS also.
Update: Check max_buffer_length - maximum size of input buffer. From the module documentation:
$len = $obj->max_buffer_length; $prev = $obj->max_buffer_length($len);
Update2: Or you can use cmd - issue command and retrieve output use die for the command and eval to capture error:
$ok = $obj->cmd($string); $ok = $obj->cmd(String => $string, [Output => $ref,] [Cmd_remove_mode => $mode,] [Errmode => $mode,] [Input_record_separator => $chars,] [Ors => $chars,] [Output_record_separator => $chars,] [Prompt => $match,] [Rs => $chars,] [Timeout => $secs,]);
Sample from Trying to capture error message using telnet::net, sample of code untested.
eval { my @lines = $obj->( String => 'who', # your long command here Errmode => 'die' ); }; if($@) { print $@; } else { print "success\n"; }
Maybe this could help.
Looking forward to your reply, if you only want telnet and nothing else, BR.
In reply to Re: Telnet command with more than 1024 chars (updated)
by thanos1983
in thread Telnet command with more than 1024 chars
by ElectricCheese
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |