How to disable echo when sending a terminal command using apache-commons-net TelnetClient

前端 未结 6 1265
醉梦人生
醉梦人生 2020-12-11 03:10

So, I have this class that uses the org.apache.commons.net.telnet.TelnetClient class. It attempts to send commands and read the response.

public class Automa         


        
6条回答
  •  臣服心动
    2020-12-11 03:48

    We have this problem also in our use of the java TelnetClient. It is inconsistent whether the telnet server returns the sent command in its responses.

    What we are doing currently to make sure the command is not included in the response data is sending the stty command to the telnet session to turn off terminal echoing. This works for telnet servers running on linux and if the command is entered in the bash shell:

    stty -echo

提交回复
热议问题