2

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?

Emil Vikström
  • 90,431
  • 16
  • 141
  • 175
OHHH
  • 1,011
  • 3
  • 16
  • 34
  • 1
    All freenode servers listen on ports 6665, 6666, 6667, 6697 (SSL only), 7000 (SSL only), 7070 (SSL only), 8000, 8001 and 8002. Did you try those? [[source](http://freenode.net/irc_servers.shtml)] – ArjunShankar Jun 24 '12 at 09:43
  • Yes, I did, apparently all ports that are greater than 3000 are blocked... – OHHH Jun 24 '12 at 20:10

3 Answers3

2

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

Community
  • 1
  • 1
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Unfortunately, my connection does not allow me to do that, I asked someone in the college and she said I was allowed to do the tunnel, that's why I ended up asking about it... – OHHH Jun 24 '12 at 20:11
1

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.

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121
0

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

user207421
  • 305,947
  • 44
  • 307
  • 483