Hacker News new | ask | show | jobs
by mike_hearn 3428 days ago
A telnet server is just a socket connected to a pty, no? I'm not sure there's much to it, which is why it's so easy in node.

I guess in java you'd do the same program something like this:

    ServerSocket server = new ServerSocket(8080);
    while (true) {
        try (Socket sock = server.accept()) {
            sock.getOutputStream().write("Hello world!".getBytes());
        }
    }
It's a bit more verbose, but hey, that's Java.

I think maybe the issue there is you got distracted by the idea that you needed a library. Commons-Net doesn't actually provide a telnet server because it doesn't need to.

That said, I agree that Commons-Net doesn't have great docs. I think it's fallen out of use over time. These days if you wanted a powerful non-blocking socket library you'd use Netty or VertX. The docs for Netty are much better:

http://netty.io/wiki/index.html

1 comments

Cheers for the example. The Commons-Net library was where I ended up after some searching - so my experience is of someone who wants to get from 0 to 100 asap.

Cheers and have a good day!