I have a Raspberry Pi (Debian Linux) connected to my LAN that can read data from some connected devices and output it to STDOUT.
Let's say the program is run on "Server" and I want to serve the output of the script
/usr/bin/data to port 1234.
I want any client to pull the output of that script by connecting to that port, using something like
nc Server 1234 > ServerData.txt
I want the server to stay alive, run the script for each connection, serve the data and then close the connection to the client. Server needs stay alive and wait for the next connection.
What is the netcat command to run on Server???