I'm looking for a tool that starts a socket server, and forwards incoming requests on that socket port to another internal one.
socat is able to forward socket ports in general:
socat tcp-l:8080,fork,reuseaddr tcp:127.0.0.1:12345
This forwards the "official" port
8080 to internal socket port
BUT: my problem is that clients should be able to connect to port
8080 even if internal port
12345 is currently unavailable.
The problem with socat is that it does not seem to create a real socket server, but justs remapps the port, and just puts the port on LISTENING.
I'm looking for a tool that tells the client "You connected successfully, please send me your input". And if my local port
12345 is not available, the clients should get an error when trying to send data.
So in case my local application is down, clients should still be able to establish a connection to that official ort.
Is that possible without having to write my own tool?