I have an old legacy application I’m trying to get to work with our semi-modern network. This application sends log messages as HTTP requests (one log per request) but does so over a single TCP connection. If that TCP connection dies, the logs get messed up as there is no queue for them.
I decided to use socat to try and hold a TCP session open while breaking up the HTTP requests on the other end for further processing. I have something like this:
socat tcp-listen:8888 tcp-connect:logserver:80
The problem is when the web server listening on “logserver” accepts an HTTP connection from socat, it tears down its TCP connection, which causes socat to tear down the listening socket the application server wants open.
How do I get socat to reconnect on the upstream side whenever it goes down and then just keep pushing data through from the listener?
I’ve tried using “fork” on the listening side, but that still tears down the connection. I almost want to add “fork” on the tcp-connect side but that doesn’t seem to be allowed.