Telnet commands automation through File or String in Java -
i automating telnet commands using apache.commons.net in java. able run program standalone, nature of telnet interactive, how can run telnet commands through file or string variable?
there 2 ways handle interactive command-based interface programatically.
the simple way: have list of commands, , send 1 after small delay between them.
the complicated way: have simple rule-based system, read remote system , matches text against 1 or more rules. depending on matching rule, perform action, sending command.
the first way indeed simple, doesn't handle errors or problems well. if there problem, not notice, continuing send commands may make problems worse.
the second way in turn implemented simple, reading text remote system, , if doesn't match expect bail. handled simple finite state machine. suitably designed , implemented might able handle connection troubles gracefully.
Comments
Post a Comment