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.

  1. the simple way: have list of commands, , send 1 after small delay between them.

  2. 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

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -