A very critical piece of advice if you end up opening your own sockets: make sure to use Java standard library imports, adapted to Jython. Resist the temptation to use the Python standard library, especially for socket related code. It's buggy and prone to resource leaks.