Java telnet server

9.5k Views Asked by At

Does anyone know of a simple telnet server?

I want to embed in my application and set my own commands something simple not complex .

3

There are 3 best solutions below

0
On

I did as below

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());
    }
}
1
On

Try this one,

http://code.google.com/p/telnetd-x/

A telnetd alone is useless. You have to connect it to a shell. We use jacl and jyson as shell.

0
On

I have written a simple Telnet server in Java: TelnetStdioRedirector