Slow socket open

When using the python socket lib, it is slow to open the socket -4.5 seconds. If I try in just a terminal in python and not jython on Windows, it takes about 1 sec. Does anyone else have this issue and does anyone have a workaround beyond just trying to keep the socket open forever?

One workaround would be to use the Java socket API instead.

1 Like

It requires some care handling scripting object lifetimes, but this is what I do. And I use the Java libraries as Kevin suggests, not python.

You are right! … there is something very wrong with jython’s version of the python socket lib.

~4.5 seconds to connect using python’s socket
~0.003 seconds to connect using java.net.Socket

I will use java, but that is kinda a bummer that python is so inefficient here.