Use nc to write multiple files - how?
I want to use nc
as a simple TCP / IP server. So far I am running it using:
$ nc -k -l 3000 > temp.tmp
This works, but it writes all received data of all connections to one file. But I would like to have separate files.
Basically I get this if I skip the switch -k
, but then nc
shut down as soon as the first connection goes away.
How can I save nc
but use a separate file for each incoming request? (Or, if this is not possible, is there an alternative * nix tool that can do this?)
Note that I do not want to restart nc
, but I want to have it all with one running instance.
PS: I know SO does not resolve tool search questions, but for me this is only a fallback case if nc
it cannot do it on its own. So sorry for the parenthesis part ...
source to share