1

I'm currently building a Java application which will connect to a switch using Telnet or SSH. I'm currently using the JSch for the SSH connection, but I read in Stack Overflow question SSH and Telnet library for java that JSch also supports Telnet.

Is this correct? And if so, could some one provide a small example?

Community
  • 1
  • 1
noobCoder
  • 370
  • 1
  • 8
  • 18
  • This contains what looks like a telnet connection class using JSch: http://stackoverflow.com/questions/27146991/ssh-telnet-on-jsch – David Feb 22 '16 at 17:18
  • Thanks for the link man, but unfortunately that is a ssh connection with the port 22 number instead of 23 for telnet. – noobCoder Feb 22 '16 at 18:42
  • @Belove That code opens an SSH shell session and runs a `telnet` command on the remote server. So it actually does not implement the Telnet protocol. It just runs the `telnet` command. I've edited the post to make it clear. – Martin Prikryl Feb 22 '16 at 19:06

1 Answers1

0

The JSch is an SSH library.

Quoting the JSch web page:

JSch is a pure Java implementation of SSH2.

No mention on Telnet.


Also, there's no mention of the "telnet" or "23" in the JSch source code.

The only classes that connect anywhere (= use Socket Java class) are Session (SSH), Proxy* and ChannelForwardedTCPIP (port forwarding) and ChannelX11.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • cool thanks man. if anyone is wondering what library to use for telnet in java apache have a library that i'm using now and it seems to work fine. – noobCoder Feb 22 '16 at 19:32