I have an application called Server on localhost which binds to port 1000. I have another application also on localhost called Client which connects to 1000 in order to communicate with Server.
I am unable to change the source code for Server or Client.
I wish to write an application called Middle and I want Client to connect to this application instead of to Server. Middle shall forward the data it receives from Client on to Server and also forward the replies from Server to Client.
I wish for Middle to also reside on localhost.
Is this possible?
I had though that iptables could be used by port forwarding data on 1000 to another port but this will also effect Middle stopping it from sending to Server. So the forwarding needs to be application specific.