主持人A:
tar cf - stuff | dd | nc -N -l 12987
主持人B:
nc a.example.com 12987 | dd | tar tf -
在主机上dd
在tar
完成后打印它的总结。 因此很明显,tarclosures了pipe道/文件 – > EOF
。
165040 + 0logging在165040 + 0logging出84500480字节在25.464802秒(3318325字节/秒)
在这两个主机上, nc
高兴地坐在那里,不退出。 nc(1)
:
-N shutdown(2) the network socket after EOF on the input. Some servers require this to finish their work.
因此,在主机上nc
应该已经看到了EOF
,closures了该死的socket并且主机B nc
应该已经看到了TCP连接终止,并且应该已经closures了stdout
( stdin
of dd
/ tar
)。
如何告诉nc
closures主机B的stdout
/终止并终止在主机A上 。
nc
错误?
-D
(debugging)什么都不做。 nc
甚至不能告诉它的版本号… 叹气
两台主机都是FreeBSD 10.3-RELEASE-p4 ,仅限IPv4。
nc
build立一个双向连接。 即它从主机B发送stdin
到主机A以及所需的从A到B.
在主机B上使用-d
忽略stdin
。 -N
在主机A上仍然需要closuresEOF上的TCP
连接。
综上所述
主持人A:
tar cf - stuff | dd | nc -N -l 12987
主持人B:
nc -d a.example.com 12987 | dd | tar tf -