小编Ben*_*Ben的帖子

带有 nc 的双向 socat 功能

这个问题与https://superuser.com/questions/270698/how-is-it-called-when-listeningconnecting-two-sockets-and-exchanged-data-betw有某种关系

在测试设置中,我打开了三个终端窗口

Term1: "nc -l 55545"
Term2: "nc -l 55546"
Term3: "socat tcp:localhost:55545 tcp:localhost:55546"
Run Code Online (Sandbox Code Playgroud)

Term1 的输入现在出现在 Term2 中,Term2 的输入出现在 Term1 中。

这是所需的行为。如何仅使用 nc 来实现此行为?

当我跑进去

Term3: "nc localhost 55545 | nc localhost 55546"
Run Code Online (Sandbox Code Playgroud)

然后 Term1 的输入出现在 Term2 中,但 Term2 的输入出现在 Term3 中。我怎样才能使管道双向?如果可能,没有临时文件。

netcat socat

3
推荐指数
1
解决办法
9536
查看次数

标签 统计

netcat ×1

socat ×1