(Continuously) Stream binary data on localhost
I have a binary file on disk and I want to stream the binary file on my localhost on a specific port. Preferably forever just repeating the file contents.
How can I do that?
Solution 1:
The nc
command could be used to do that. For example this is how you would create a TCP connection on port 12345 and stream a file to that. The -k
option will keep the socket open after a client connected:
nc -k -l 12345 < input_file