Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Maximum length of commands in Net::Telnet package

by deba (Initiate)
on Jun 09, 2004 at 12:30 UTC ( [id://362700]=perlquestion: print w/replies, xml ) Need Help??

deba has asked for the wisdom of the Perl Monks concerning the following question:

It seems cmd or print methods of Net::Telnet package can handle at most 255 characters. Beyond that the command is truncated. The behaviour is reproducible both on Solaris 8 and AIX 5.1. with latest versions of perl and Telnet package.

Suspect the problem with _put method where it calls syswrite. Has anybody found any similar problem? Is it a feature of telnet protocol or a genuine bug? I couldn't find any logged bug for this scenerio.

Our current approach is to break the command string to smaller chunks and send again and again using put function. But a preferable way would be to specify max command length as a parameter like timeout.

A test program is pasted

################ #!/spare/perl/bin/perl use Net::Telnet; my $t = new Net::Telnet(Host=> "myhost", Timeout=> 20); $t->login("mylogin", "mypasswd"); @lines = $t->cmd("echo ddddddddddddddddddddddddddddddddddddddddddddddd +ddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +eeeeeeeeeeeeeeebbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +); print @lines; ###########################
Could somebody enlighten me on this issue?

Thanks and regards,

Debashish.

Replies are listed 'Best First'.
Re: Maximum length of commands in Net::Telnet package
by arthas (Hermit) on Jun 09, 2004 at 12:42 UTC

    Hi!

    I tested this using Slackware Linux 9.1 (telnetting a FreeBSD host) and there is no truncation.

    Hope this information helps! ;)

    Michele.

      I have encountered this problem in HP-UX 11i as well.
Re: Maximum length of commands in Net::Telnet package
by idsfa (Vicar) on Jun 09, 2004 at 18:10 UTC

    This is not a perl problem. Try your long command from the command prompt on the AIX box and you'll find it truncated in the same place (tested).


    If anyone needs me I'll be in the Angry Dome.
      No it's not the case. I have tested it on the command prompt on both AIX and SOLARIS and there is no truncation problem. In your case there might be some system configured limit.

      Definitely a perl problem.

      My theory is, syswrite isn't able to write the whole chunk. And in _put method it waits for response after syswrite. Because the command isn't complete there is no response and the command timesout. I am yet to verify this though.

      I can give a temporary login if somebody is really willing to experiment it on my systems.

      echo isn't the command we use in actual case. It was used for demo only.

      I am available on yahoo IM as pspl_deba and on msn as debashish99@hotmail.com should some body be really willing to sort this out on chat.

      Thanks and regards,

      Debashish.

        Please do a little research before submitting something as a bug on rt.cpan.org. idsfa is correct - it has nothing to do with perl or Net::Telnet. This has been discussed before on comp.lang.perl.misc. http://groups.google.com/groups?as_umsgid=82u2iyo3s9.fsf%40shell2.shore.net Can you please close the bug you submitted? -- Jay Rogers
Re: Maximum length of commands in Net::Telnet package
by Anonymous Monk on Jun 10, 2004 at 00:28 UTC

    it may also be your choice of $SHELL and whether or not the 'echo' command is a builtin or binary.

    i've sent full router configs in a Net::Telnet cmd without problems...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://362700]
Approved by Happy-the-monk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-03-28 21:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found