• Post Reply Bookmark Topic Watch Topic
  • New Topic

Looking for a Java Telnet Server  RSS feed

 
JD Glanville
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all.

Does anyone know of an open-source telnet server implemented in Java?

Thanks
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Open source Java telent clients are easy to come by. I don't see any servers out there. Probably because there's already established implementations for every operating system, the fact that server is tightly bound to the operating system due to user authentication and process control making Java a poor choice for implementation and because telnet is going the way of the dodo as it is less secure than SSH.
 
sander hautvast
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to build one once, but ran into the problem of maintaining an open session from Runtime.exec() to the os. You can send one command (like cd dir) but the new directory won't be 'dir' for the next command. It will be the current directory for the java runtime again.
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sander hautvast:
You can send one command (like cd dir) but the new directory won't be 'dir' for the next command.


That's because two calls to runtime.exec() starts two seperate processes, and they each start with the environment they inherit from the virtual machine. This is the behavior you want since you don't want two simultaneous connections to your server clobbering each other's commands.
 
sander hautvast
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure, but i was hoping to be able to use Proces.getOutputStream to send new commands to the shell behind the Proces object , but this did not happen.
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The input stream is used to send commands. The output and error streams are used to get the results. You also should use seperate threads for each of the streams as there's no way to tell when a command's output has ended.
 
sander hautvast
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you cannot send sth to an InputStream
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I stand corrected. The getOutputStream() method of Process returns an OutputStream which may be used to send commands. The getInputStream() and getErrorStream methods return InputStreams which one may use to get the output. Nonetheless, it works for me.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!