26 Sep, 2009, bbailey wrote in the 1st comment:
Votes: 0
I'm looking for a reasonable telnet library in java. So far I've not had much luck. I've found telnetd2 and flumpy's improvements to it. Does anyone have alternatives they'd like to suggest?
11 Oct, 2009, flumpy wrote in the 2nd comment:
Votes: 0
bbailey said:
I'm looking for a reasonable telnet library in java. So far I've not had much luck. I've found telnetd2 and flumpy's improvements to it. Does anyone have alternatives they'd like to suggest?


Sorry for the delayed reply on this, things have been hectic here as you may have seen :S

When I was looking for a telnet library, telnetd2 was the only implementation I could find anywhere on the internet. I scoured the net for about a week before realising this was my only choice, and when I used it saw that it was severely flawed because of the bug in it.

The only thing that even comes close would be Apache Mina's ssh daemon implementation, but it looks very immature (or was, when I last looked) and is, well, ssh and not telnet :(

I know this isn't really what you want to hear, but there you go.

One day, I will write my own. Or you can write yours, and then I'll nick it ;)
11 Oct, 2009, bbailey wrote in the 3rd comment:
Votes: 0
flumpy said:
One day, I will write my own. Or you can write yours, and then I'll nick it ;)


Bah. That was MY plan. ;)
11 Oct, 2009, David Haley wrote in the 4th comment:
Votes: 0
Out of curiosity, why is this so hard? What are the gotchas you're encountering in writing a telnet library? What is the scope of tasks you expect it to accomplish?
11 Oct, 2009, flumpy wrote in the 5th comment:
Votes: 0
David Haley said:
Out of curiosity, why is this so hard? What are the gotchas you're encountering in writing a telnet library? What is the scope of tasks you expect it to accomplish?


Well at the moment it's just a time thing. I don't have any…

edit: unless you were talking to bbailey?
11 Oct, 2009, bbailey wrote in the 6th comment:
Votes: 0
flumpy said:
David Haley said:
Out of curiosity, why is this so hard? What are the gotchas you're encountering in writing a telnet library? What is the scope of tasks you expect it to accomplish?


Well at the moment it's just a time thing. I don't have any…

edit: unless you were talking to bbailey?


I'll echo the 'no time' sentiment. Also, at this point I don't believe I've researched it enough to make an honest attempt at creating one in Java. Thus my hunt for examples so I can study approaches already taken. This is much more straightforward in system languages like C and C++ where there are ample examples.
11 Oct, 2009, David Haley wrote in the 7th comment:
Votes: 0
Ah, I see.
Well, if I ever decide to do something in Java, and I need a telnet library, I will write one up and post it as a by-product. :smile:
(Although I like Java, it's somewhat harder to integrate it with Lua than it is for C/C++, which is why I'm sort of staying away. But I do like Java…)
11 Oct, 2009, flumpy wrote in the 8th comment:
Votes: 0
David Haley said:
Ah, I see.
Well, if I ever decide to do something in Java, and I need a telnet library, I will write one up and post it as a by-product. :smile:
(Although I like Java, it's somewhat harder to integrate it with Lua than it is for C/C++, which is why I'm sort of staying away. But I do like Java…)


I think there are java implementations of lua: JLuasprings to mind…
12 Oct, 2009, David Haley wrote in the 9th comment:
Votes: 0
Yes, there are ways to do it; there's Kahlua (not a full implementation), LuaJava (a JNI binding to the C implementation, but last I checked for an older version only), JLua (only a parser for now, I believe), and a few others. If I were committed to Java, I'd just update LuaJava. The question is then how much I care about Java to add that extra work. :smile: I like C++ a lot too, enough that I'd be happy to use that as well.
12 Oct, 2009, flumpy wrote in the 10th comment:
Votes: 0
David Haley said:
Yes, there are ways to do it; there's Kahlua (not a full implementation), LuaJava (a JNI binding to the C implementation, but last I checked for an older version only), JLua (only a parser for now, I believe), and a few others. If I were committed to Java, I'd just update LuaJava. The question is then how much I care about Java to add that extra work. :smile: I like C++ a lot too, enough that I'd be happy to use that as well.


When you start using Java you dumb down a bit, well, IMHO anyway.

I can't remember or put in to practice half the things I learnt at Uni on my c and cpp courses now :(
12 Oct, 2009, David Haley wrote in the 11th comment:
Votes: 0
Oh, how so? It simplifies some things, but not more than other languages, and probably far less than languages like Python, Ruby, Lua, …
Anyhow I don't mean to derail Bobby's thread, I was just saying why I might write a telnet library for Java, but haven't so far. :smile:
12 Oct, 2009, flumpy wrote in the 12th comment:
Votes: 0
David Haley said:
Oh, how so? It simplifies some things, but not more than other languages, and probably far less than languages like Python, Ruby, Lua, …
Anyhow I don't mean to derail Bobby's thread, I was just saying why I might write a telnet library for Java, but haven't so far. :smile:


Well, just the whole memory allocation thing and pointers and stuff. I really liked pointer arithmetic.

And I hardly ever use the bitwise operators at all any more, either. I'm sure that's just a by-product of the type of work I'm doing really - business logic really doesn't require it.

I don't want to hijack this thread either, so if you want to talk more about it we can move it to IMC next time we're both on?
13 Oct, 2009, elanthis wrote in the 13th comment:
Votes: 0
Just port libtelnet. It's clean C, written in a semi-OO manner that translates well to Java, and the only thing in it that wouldn't directly port to Java almost line-by-line is the memory-efficient (but not necessarily CPU-efficient) RFC1143 implementation. That whole bit can even just be ignored if you don't feel like using the Q-method of option negotiation, and a good Java dev could port it with similar efficiency characteristics too.

The basics of parsing and interpreting TELNET are easy. Doing it right is ridiculously easy, even. A simple state machine handles the core protocol with 100% correctness, and a few extra bits for handling the goofy option negotiation setup and a few other core options are all you need to support the relevant standards. MCCPv2, ZMP, MSSP, etc. are only a tiny bit of extra work to tack on, too.
05 Nov, 2009, Zod wrote in the 14th comment:
Votes: 0
bbailey said:
I'm looking for a reasonable telnet library in java.


I decided to write my own for Terebi. It's not very pretty at the moment, because I did the usual "I can login, so that's enough for now" approach. :)

If you want to look at it, grab the latest revision out of mercurial, and then head to the "net" module.

I didn't bother using telnetd2, but the original code base was pretty ugly and seemingly abandoned, and the new version was tightly tied to OSGI.

When I've finished my bytecode generator, I'll probably go back to it and try and clean it up, so if anyone's interested in collaborating on a library, I'm keen to work together. Happy to build from mine, or start with telnetd-x (even if it has been mavenised, ugh!)
18 Feb, 2014, Idealiad wrote in the 15th comment:
Votes: 0
Arise, ye thread.

So I'm in the same boat as bbailey in days of yore. I've looked at the Java options from this thread but all of them (and the ones I've found in the wild) seem to use a thread-per-connection. And don't even get me started on people saying they wrote a 'telnet' server without an IAC in sight….

Seriously though, I'm not absolutely opposed to thread-per-connection, and I realize many muds get by without much (or anything) in the way of a telnet implementation. Nevertheless, does anyone know of a barebones single-threaded Java telnet server out there?
18 Feb, 2014, Tyche wrote in the 16th comment:
Votes: 0
Here's something I wrote back in 2002. It neither compiles or runs now.
However, it was a working single threaded at one time. :-/

ftp://sourcery.dyndns.org/pub/mud/freebeermud....
0.0/16