加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows – 在同一端口上侦听的多个进程?

发布时间:2020-12-13 20:36:31 所属栏目:Windows 来源:网络整理
导读:我试图了解如何在Windows XP上启动多个进程侦听相同的TCP {IP,Port}对. 例如,我可以启动两个在端口371上侦听的ncat.exe程序.第二个启动没有任何问题并接收传入连接而第一个没有.一旦最后开始的过程终止,第一个接收它们. netstat -a -n | find "LISTENING" TC
我试图了解如何在Windows XP上启动多个进程侦听相同的TCP {IP,Port}对.

例如,我可以启动两个在端口371上侦听的ncat.exe程序.第二个启动没有任何问题并接收传入连接而第一个没有.一旦最后开始的过程终止,第一个接收它们.

netstat -a -n | find "LISTENING"
   TCP    0.0.0.0:371            0.0.0.0:0              LISTENING
   TCP    0.0.0.0:371            0.0.0.0:0              LISTENING

假设这是一个Windows(XP)行为,它怎么能是一个安全的&安全行为?这意味着可以“重载”任何已经侦听的端口,而不是获取通常的“已使用的地址”错误消息,并简单地绕过防火墙,其规则只是说“允许端口371上的任何传入TCP连接”.

SO_REUSEADDR套接字选项在Windows中有不同的解释,即在Linux中,它允许您重用相同的套接字,除非所有五个元组(src / dst端口/ ip和协议完全相同).

但是,Windows实际上允许您窃取套接字.我会引用一个更好的written answer来详细阐述两者.

Windows only knows the SO_REUSEADDR option,there is no SO_REUSEPORT. Setting SO_REUSEADDR on a socket in Windows behaves like setting SO_REUSEPORT and SO_REUSEADDR on a socket in BSD,with one exception: A socket with SO_REUSEADDR can always bind to exactly the same source address and port as an already bound socket,even if the other socket did not have this option set when it was bound. This behavior is somewhat dangerous because it allows an* application “to steal” the connected port of another application. Needless to say,this can have major security implications.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读