有谁知道一个简单的远程登录服务器?
我想嵌入到我的应用程序中并将我自己的命令设置为简单而不复杂。
我用 Java 编写了一个简单的 Telnet 服务器:TelnetStdioRedirector
我做了如下
public static void main(String[] args) {
String url = "hostname";
int port = 8080;
try (Socket pingSocket = new Socket(url, port)) {
try (PrintWriter out = new PrintWriter(pingSocket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(pingSocket.getInputStream()));) {
out.println("ping");
System.out.println("Telnet Success: " + in.readLine());
}
} catch (IOException e) {
System.out.println("Telnet Fail: " + e.getMessage());
}
}