in reply to Telnet command with more than 1024 chars
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Telnet command with more than 1024 chars (updated)
by ElectricCheese (Initiate) on Jul 19, 2017 at 18:38 UTC | |
by thanos1983 (Parson) on Jul 19, 2017 at 23:04 UTC | |
by ElectricCheese (Initiate) on Jul 25, 2017 at 19:49 UTC | |
by soonix (Chancellor) on Jul 20, 2017 at 11:52 UTC | |
by ElectricCheese (Initiate) on Jul 25, 2017 at 19:17 UTC |