I have a provider (A) that wants to send us data through an incoming TCP connection. Unfortunately the consuming service (B) cannot receive inbound TCP connections. Also it does not have a static IP, another requirement.
One way to solve this would be a service that connects the incoming TCP A port to another TCP port B, so that the consumer can make an outbound connection to B.
socat -d -d -d -u TCP4-LISTEN:PORT-A,reuseaddr TCP4-LISTEN:PORT-B,reuseaddr
However, this has the following problems:
- If B disconnects, it cannot re-connect. With
TCP4-LISTEN:PORT-B,reuseaddr,fork, it can connect but does not receive data.
- B cannot connect before A has established a connection (surmountable)
- Only one connection can be established to
Is there a way to adjust the command so that is becomes "permament" and resistent to failures?