I'm using 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[435965] E connect(5, AF=2, 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.