Description
This library implements a basic telnet server that can be extended with custom commands and handlers, for more information, visit the javadoc, you can find it on the menu bar.
Examples
Bare minimum code to create a server in the port 7007 with "help" and "exit" commands:
import org.cristian.t4j.TelnetServer;
public class Testing {
public static void main(String[] argv) {
TelnetServer Server = new TelnetServer();
Server.start();
}
}
You can add commands to the server:
import org.cristian.t4j.TelnetServer;
public class Testing {
public static void main(String[] argv) {
TelnetServer Server = new TelnetServer();
Server.registerCommand(new HelloWorldCommand());
Server.start();
}
public static class HelloWorldCommand extends TelnetServer.Command {
public HelloWorldCommand() {
super("hello");
}
@Override
public String getShortDescription() {
return "Prints the classic hello world command.";
}
@Override
public void execute(java.io.PrintWriter STDOUT, java.io.BufferedReader STDIN, String[] Argv) {
STDOUT.println("Hello World!");
}
}
}
License
This software is licensed under the GNU General Public License Version 3.