OHHH
OHHH

Reputation: 1051

Java SSH Tunneling for an IRC chat

My program connects to an IRC room on freenode.net, it uses port 6667, apparently that port is blocked in my college so the project doesn't work there (I wish I had known that before I proposed that one, but it's due the next week so I can't make a new project now). I read that it was possible to tunnel that connection, but I'm not sure how to do it.

I read I had to use an SSH library but I can't find one that helps me tunneling the connection using a socket.

I found a package called ssh in MindTerm but a really old one, that basically does the process (I think) using these lines:

SSHSocketFactory fact = new SSHSocketFactory("ssh.freessh.biz", 22, new SSHPasswordAuthenticator("freessh", "7QO5dkmg<"));

ventanachat.socket = fact.createSocket(servidorirc, puerto);

It gives me: java.io.IOException: MindTerm do not support SSHv2 yet, enable SSHv1 compatibility in server

So I tried a new version that has ssh2 support, but I just can't get the same process since classes are different here and there's no documentation.

The socket is basically Socket socket = new Socket ("irc.freenode.net", 6667);

I am wondering what library could I use, and how?

Upvotes: 2

Views: 644

Answers (3)

user207421
user207421

Reputation: 310850

Ganymed and Jsch both support SSH tunnelling, and both are free.

Upvotes: 0

Stephen C
Stephen C

Reputation: 718698

You are liable to get into trouble for circumventing blocks of the IRC port.

I've got another idea. Download and install IRC server software on the machine you are doing development on. Then you should be able to connect to it from your client without anything blocking the port. (And if you still run into port problems, just configure the client and server use a different one.)


Alternatively, look at the answers to this SO question: Simple SSH Tunnel in Java

Upvotes: 2

There's a couple of SSH libraries for Java present on the market and most of them support SSH tunneling. We offer SecureBlackbox product (Java edition) which has samples (including tunneling), documentation and support.

Upvotes: 1

Related Questions