socat -lf z:\socat.log -d -d tcp4-listen:<local-port>,fork
socks4a:localhost:<remote-IP>:<remote-port>,socksport=9050
In Windows this command at the prompt of a machine with socat installed
would make socat listen for tcp4 data on <local-port>, which it then sends
to localhost, but which you can replace with any IP, where the socks proxy
is running and accepting data on port 9050, for instance; it then sends the
data to <remote-IP> and <remote-port>. The part at the beginning of this
command ( -lf z:\socat.log -d -d ) causes a log file to be created at
directory location z:\socat.log, but you can change the location of course,
and adding more of the "-d", plus space, adds levels of verbosity to the
log. I hope this helps you. The current stable version of socat accepts
socks 4 and 4a, but there is a newer beta version that is supposed to accept
socks 5, though I have not used it yet.
I use socat with great success, but every so often I have to restart the
program once or twice initially. After that is done, it stays connected
well, at least in my experience it remains quite stable. It is an amazing
program.