java - Sending Multiple Commands to device Through SSH -
i attempting send multiple commands device using sshj library. there option of sending multiple commands in format:
command command = sshsession.exec("show line; show ip interface brief;"); this works, not usable in case. have found other suggestions such second answer here.
when attempt suggestion first command works fine , cycles between error:
net.schmizz.sshj.connection.connectionexception: broken transport; encountered eof ... caused by: net.schmizz.sshj.transport.transportexception: broken transport; encountered eof or
exception in thread "main" java.lang.illegalstateexception: not connected @ net.schmizz.sshj.sshclient.checkconnected(sshclient.java:713) @ net.schmizz.sshj.sshclient.startsession(sshclient.java:651) the code used is:
sshsession = sshclient.startsession(); command command = sshsession.exec("sho ip int brie"); system.out.println(ioutils.readfully(command.getinputstream()));//just see reply while testing command.join(5, timeunit.seconds); sshsession = sshclient.startsession(); command command2 = sshsession.exec("sho line"); system.out.println(ioutils.readfully(command2.getinputstream()));//just see reply while testing a note if needed, device connecting to, , majority of devices connect cisco networking equipment.
thank assistance. -jarrod
never found resolution exact problem. worked around issue using defaultpty , providing own streams data wanted send. playing around this example.
Comments
Post a Comment