Use nc to write multiple files - how?

前端 未结 3 1877
误落风尘
误落风尘 2021-01-28 06:31

I want to use nc as a simple TCP/IP server. So far I run it using:

$ nc -k -l 3000 > temp.tmp

This works, but writes all the re

相关标签:
3条回答
  • 2021-01-28 07:17

    Omit the -k and run it in a loop:

    n=0
    while nc -l 3000 > "$n".txt ; do
       n=$((n+1))
    done
    
    0 讨论(0)
  • 2021-01-28 07:29

    On the receiver:

    $ nc -p 3000 -l | tar -x
    

    On the sender:

    $ tar -c * | nc <ip_address> 3000
    
    0 讨论(0)
  • 2021-01-28 07:29

    I think Cronolog can help in this case

    -p option you can determine the period option

    Also the filewatcher utility "incron" can be used which will check logs to one file & can split to some other files

    0 讨论(0)
提交回复
热议问题