How in the Nim language to handle the response of programs like tcpdump, which works in parallel with the program on Nim?

  • What is tpdump? And where does he give his conclusion? If, judging by the question, in stdout / stderr, then clarify the question again - do you have a problem with reading standard streams, or with reading the output of this particular program? - dunduk
  • Add the nim tag. - antage
  • one
    @dunduk tcpdump is a sniffer. The output flows in a continuous stream to stdout. I have no problem reading the single output. There are problems with handling such a permanent output. - Artyom Badrtdinov
  • @antage reputation so far is too small to add new tags) - Artyom Badrtdinov
  • @ArtyomBadrtdinov, well, so in the cycle, read one line at a time and process it. In the console, run like this: tcpdump | ./yourprogram tcpdump | ./yourprogram , and all tcpdump output will be sent to the standard input of your program. - Vadim Shender

1 answer 1

response from comment:


In the loop, read one line at a time and process it. In the console, run as follows:

 $ tcpdump ... | ./yourprogram 

and all tcpdump output will be sent to the standard input of your program.