socat to forward to another port on localhost:
socat tcp-l:5050,fork,reuseaddr tcp:localhost:2020
Problem: if the program running on
2020 is down, socat will answer incoming connections like:
socat E connect(5, AF=2 127.0.0.1:2020, 16): Connection refused
Question: can I make socat collect incoming messages, putting them on hold until the target port becomes alive again (at least within a timeout of eg some minutes)?
What I'm looking for is: socat should pretend to clients that the port
5050 is still alive, and the connection should just hang until application on port
2020 comes alive and accept the socket request from waiting 5050.