开源 Telnet Java API
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3480755/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Open source Telnet Java API
提问by shipmaster
Is there an open source telnet API/library out there for Java (something like Python telnetlib)? I need to connect to a server using telnet and execute some commands from within a Java program.
是否有用于 Java 的开源 telnet API/库(类似于 Python telnetlib)?我需要使用 telnet 连接到服务器并从 Java 程序中执行一些命令。
采纳答案by Paul Kuykendall
My preference is to use the Apache Commons-Net library. http://commons.apache.org/net/It supports many client protocols, including Telnet.
我更喜欢使用 Apache Commons-Net 库。http://commons.apache.org/net/它支持多种客户端协议,包括 Telnet。
I've used this in the past and it works quite well.
我过去用过这个,效果很好。
回答by kofucii
Maybe is worth considering using SSH protocol, instead of Telnet. Telnet is much less secure, for instance all the data is transmitted as plain text (including your passwords).
也许值得考虑使用 SSH 协议,而不是 Telnet。Telnet 的安全性要低得多,例如所有数据都以纯文本形式传输(包括您的密码)。
回答by Teekin
Sure is.
当然是。
http://sourceforge.net/projects/jtelnet/(EDIT: Noted as crap.)
http://sourceforge.net/projects/jtelnet/(编辑:注明为废话。)
Here is an Apache project which is presumably much more handy:
这是一个 Apache 项目,大概更方便:

