I have two applications on two networked Linux machines on the same LAN. One runs a server program which listens for TCP connections on a specified port and when connected, emits (but does not receive) data. A client program on a different machine listens for TCP connections and when connected, expects to receive the data sent by the server (but does not emit any itself).
Until now I have been using either
nc server1 30000 | nc client1 29999 or
socat -u TCP:server1:30000 TCP:client1:29999, however with either solution once the network connection fails, the process does not end and doesn't automatically re-connect.
Is there an elegant way to do this?
Earlier I was considering multicast; i.e. have the server multicast the data across the network, but that would require one of the above commands on each computer to terminate the data stream and might end up with the same problems.
This connection only transfers a small amount of data; certainly nowhere near enough to saturate bandwidth or CPU.