linux – 永远与netcat代理
|
我用netcat代理VNC TCP服务器端口.代理机器运行 linux. 这是我使用的命令: mkfifo backpipe nc -l 5902 0<backpipe | nc 10.1.1.116 5902 1>backpipe 10.1.1.116是“远程”计算机,其原始VNC服务在端口5902上运行.此命令后,本地主机上的VNC服务可用于其他计算机. 但是在每次VNC会话之后,netcat“代理服务器”停止,这就是netcat的工作方式. 在VNC会话终止后,如何使netcat保持“代理服务”运行? 作为一种解决方法,我将netcat命令行放在一个无限循环中: mkfifo backpipe while true; do nc -l 5902 0<backpipe | nc 10.1.1.116 5902 1>backpipe; done 但我更喜欢一种“官方”的netcat解决方案,它根本不会中断服务. 我已经阅读了“ – ”参数,但我不确定这是否适合这种情况,我还不能正确应用它. 补充说明: 当然,我可以通过不同的方式使用ssh隧道来实现这一点,但我想要一个没有加密开销的解决方案,以使其尽可能响应VNC客户端.否则,不同的代理解决方案就可以了. 客户端必须是VNC,不可能有其他协议. 解决方法-k选项应该可以解决问题.从nc(1)的联机帮助页: -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.
我注意到Debian / Ubuntu上的netcat-traditional软件包没有按照它应该继续监听.在这种情况下,请使用netcat-openbsd包,然后再试一次! 或者,使用socat,它更适合您使用代理服务器.来自socat手册页的随机TCP转发器示例,当然需要进行一些修改. socat -d -d -lmlocal2
TCP4-LISTEN:80,bind=myaddr1,reuseaddr,fork,su=nobody,range=10.0.0.0/8
TCP4:www.domain.org:80,bind=myaddr2
TCP port forwarder,each side bound to another local IP
address (bind). This example handles an almost arbitrary
number of parallel or consecutive connections by fork'ing a
new process after each accept() . It provides a little secu |
- linux – Postgres DISK IO非常高.我该怎么做才能立即减少它
- linux – 如何从IntelliJ / WebStorm / PhpStorm中的“外部
- linux – 有没有办法让APT将软件包安装到我的主目录?
- linux – 我们如何在Bash中获得两个数组的并集?
- Ubuntu 16.04 – malloc实现.指向下一个块的指针在哪里?
- Linux内核模块/ IOCTL:设备的ioctl不合适
- linux – 如何还原subversion忽略?
- python – linux中的谷歌应用引擎路径?
- linux – rsync运行时间太长
- linux – 为什么如果[false];然后回声’确定’;网络连接;打
