user7365441 Asked: 2017-01-05 10:09:04 +0800 CST2017-01-05 10:09:04 +0800 CST 2017-01-05 10:09:04 +0800 CST netcat,重新打开 TCP 套接字 772 我有一个 bash 脚本: #!/bin/bash while : do nc -l -p 30003 | python3 script.py done 我希望聆听始终有效。 nc localhost 30003 # works, fine *type something* Ctrl+C 再试一次 nc localhost 30003#不工作 所以,在套接字第一次关闭后,它就再也不会打开了.. 我该如何解决? 谢谢。 linux netcat 1 个回答 Voted Best Answer dawud 2017-01-05T11:18:07+08:002017-01-05T11:18:07+08:00 您需要使用该-k选项nc,它位于手册页中: -k' Forces nc to stay listening for another connection after its current connection is completed. It is an error to use this option without the -l option.
您需要使用该
-k
选项nc
,它位于手册页中: