Unix2TCP is able to listen on a local UNIX socket and tunnel any incoming connections and traffic to a (remote) IP address/port.
Example of usage: I have started this project to be able to transparently move my "local" MySQL servers to whatever location I want.
Having a web-hosting server with lots of client scripts that all connect to "localhost" (ie /tmp/mysql.sock) for talking MySQL is a problem when you want to move the MySQL server on its dedicated machine.
This is how we did it: we run unix2tcp /tmp/mysql.sock remoteip remoteport so that unix2tcp will listen to /tmp/mysql.sock and tunnel any traffic to remoteip:remoteport .
There we would have run any "normal" portforwarder to forward from "remoteport" to 127.0.0.1:3306, thus beeing able to keep the grant tables in MySQL untouched (all connection would have seem to come from localhost).
I guess there can be other solutions to this problem too, but this way its the most flexible I have found yet. Another example ideea came from a user of this program. He wanted to remain anonymous so I will respect his wish.
He used unix2tcp to trick some X applications (binary release only) thinking that they are talking to the local X server but in fact they were talking to a remote X server were he forwarded the connections.
- tunnels all traffic between a (remote) address/port and a local UNIX socket
- does NOT use fork() (single process model)
- does use O_NONBLOCK , should be no case of blocking