如何修改 netcat 命令行以一次发送多个请求

How can I modify the netcat command line to send many requests at once

假设有一个TCP服务器监听8080端口。 客户端在使用netcat命令后连接并发送,例如"hello"消息:

nc localhost:8080

如何在不打字的情况下发送 "hello" 消息 1000 次?我可以访问 Netcat 文件并添加 'for' 或 'while' 循环吗?

无需修改nc;只需将您的输入传递给它:yes hello | head -n 1000 | nc localhost:8080.