1 machine listens(linux), while multiple clients(windows) send files to it on one and the same listening port. Netcat receives the files serially with the -k tag.
Listening machine:
nc -lp PORT -k > fileX
Clients:
nc IP PORT < file??
What I want is to receive multiple files from multiple sources WITHOUT them overwriting each other.
Please look at the previous commands. The listener machine with always write output to fileX, thus overwriting the previous client's file.
I want to somehow be able to change the output filename for every different client. Can the client send the string "file10" over netcat somehow and so tell the listener to output to > file10 ?
Thank you.
EDIT: Came up with an idea:
This is automated via script:
Firstly, listener sets output file to file.txt. (nc -lp PORT > file.txt)
Client sends string (eg "file123") via netcat. (This will be the filename for the file that will be sent in the future.)
Listener writes to file.txt, then reads file.txt, and starts a new netcat listener with output file > file123
Finally, client sends data.