PDA

View Full Version : Having trouble sending long commands in SSH or telnet


lsalas
06-09-2008, 09:50 PM
When using the SshSession or TelnetSession classes you may find that when sending long commands using the send(String message) or sendWait(String message, String prompt) methods that the server only receives part of the command. This is typically due to line length limitations imposed by the server. To avoid this issue you will need to truncate your command into multiple parts using a combination of the sendRaw and send or sendWait method.

For example:

session.sendRaw("command part1");
session.sendRaw("command part2");
session.send("remainder of command");