SOCKS Library

This page contains information that might be interesting for developers, who wish to use SOCKS protocol in applications they are developing, both client and server side.

Why to use it

There are plenty of reasons for which you might want to use SOCKS library in your java application. They are generally divided in two parts
  1. You are developing a client application, which needs to access proxy.
  2. You are developing a custom Proxy server.

Client Application

Current version of java has a support for SOCKSv4 proxy, which is probably enough for most applications, which need to do some networking. Connections are being done through the proxy or directly depending on the user configurations, transparently to the java application. But SOCKSv4 has some limitations:
  1. Lack of sufficient authentication.

  2. The only authentication SOCKSv4 supports is the authentication based on Ident protocol. Basically client tells the server who he is, and server verifies it with the identd daemon running on the client machine. This technique works fine when proxy is used to let people on local network have access to the Internet. But it is not suitable when proxy is used to let people from the outside in.
  3. Lack of UDP support.

  4. SOCKSv4 protocol does not have any UDP support. And currently with almost all multimedia applications using UDP this might be a serious disadvantage.
Besides implementation of the SOCKSv4 in Java appears to be not complete (probably I'm wrong, check with sun). It appears to me that there is no way to accept a connection from the outside Firewall using Java1.2 ServerSocket.

So if you need your application to be able to

  1. Send and receive datagrams through the firewall.
  2. Accept connections from hosts behind the firewall.
  3. Provide non-trivial authentication to the proxy server.
  4. Ensure secure connection to the proxy server.
you might find that you need SOCKSv5 support, and hence this library may be useful to you. Even though I have forced the advantages of SOCKSv5 protocol, this library supports SOCKSv4 as well.

Hopefully one day Java will support SOCKSv5 as well, but it's not yet happened.

Server Application

If you are developing proxy server which need to support either SOCKSv4 or SOCKSv5 or both, you'll find using this library very time saving. There are plenty of things to take care about when developing proxy server, protocol handling is just one part of the problem, which have been solved by this library, so that you can concentrate on authentication, authorization and initialization.

There are generally two major reasons for which proxy servers are used: to let people in, or to let them out, or both. Proxy server is like a door in the Firewall. Usually you do not care all that much who gets out, but you should be very careful in deciding who gets in.

SOCKSv5 protocol provides for extendable authentication schemes, which might be standard or private. And this socks library makes it easy to use your own implementations of authentication methods. Next step after authentication is authorization, for which methods are also provided.

How to use

Now as you are convinced in the fact that you'll need to use socks library. Its time to know how to do so.

How to page will cover these issues.
I have just finished redesign and testing. There have been major changes to the library, mostly due to poor design decisions in the first stage. Few things that have been changed:

How to page is still yet to come. I haven't had time recently. As for now, read the documentation pages, they are now available online as well as archived file.
Back to SOCKS Proxy Page.