Menu

#3 Support for firewall support

open
nobody
None
5
2001-05-24
2001-05-24
Anonymous
No

Sometimes people would like to IRC from behind a firewall/proxy and are unable because the standard IRC ports are blocked. But usually web browsing is supported.

Any app can tunnel through a web proxy/firewall very easily with only a minor change to the code. All you have to do is open a socket to the proxy and write a "CONNECT <server> <port>" command to it. If it returns a 2xx code, you are set!

Here is a way to do it:

host= "irc.openprojects.net"
port=6667
proxyhost="companyproxy.com"
proxyport=80

if (proxyhost!=null){

Socket socket =new Socket (proxyhost, proxyport);

is = new DataInputStream(new BufferedInputStream(socket.getInputStream(),16384));

os = socket.getOutputStream();

PrintWriter out=new PrintWriter(os, true);

BufferedReader in=new BufferedReader(new InputStreamReader(is));

out.println("CONNECT " + host + ":" + port + " HTTP/1.0\n");

//do error checking here
String str=in.readLine();

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.