无法连接到端口,尽管它是开放的
Can't connect to port, although it is open
我用 Windows 10 IoT 设置了一个 raspi。
然后我在 raspi 上设置防火墙规则以打开端口 1600,如下所示:
netsh advfirewall firewall add rule name="Open Port 1600" dir=in action=allow protocol=TCP localport=1600
命令 netstat -an
显示以下内容:
TCP 10.3.10.200:1600 0.0.0.0:0 LISTENING
但是当我 运行 命令 Test-NetConnection -Port 1600 "ComputerName"
(在同一子网中的计算机上)时,我得到
WARNING: TCP connect to (fe80::4d23:cb14:dcf6:dc5b%9 : 1600) failed
ComputerName : ComputerName
RemoteAddress : 10.3.10.200
RemotePort : 1600
InterfaceAlias : Ethernet
SourceAddress : 10.3.10.69
TcpTestSucceeded : True
我可以毫无问题地 ping raspi。我也可以毫无问题地连接到端口 8080。
知道为什么与端口 1600 的连接失败吗?
正如@SKi 所建议的,问题可能来自尝试连接到 IPv6 地址而不是您正在收听的 IPv4 地址。相反,您可以尝试输入 IPv4 地址 10.3.10.200
作为 "ComputerName" 以将测试限制为 IPv4。
我用 Windows 10 IoT 设置了一个 raspi。
然后我在 raspi 上设置防火墙规则以打开端口 1600,如下所示:
netsh advfirewall firewall add rule name="Open Port 1600" dir=in action=allow protocol=TCP localport=1600
命令 netstat -an
显示以下内容:
TCP 10.3.10.200:1600 0.0.0.0:0 LISTENING
但是当我 运行 命令 Test-NetConnection -Port 1600 "ComputerName"
(在同一子网中的计算机上)时,我得到
WARNING: TCP connect to (fe80::4d23:cb14:dcf6:dc5b%9 : 1600) failed
ComputerName : ComputerName
RemoteAddress : 10.3.10.200
RemotePort : 1600
InterfaceAlias : Ethernet
SourceAddress : 10.3.10.69
TcpTestSucceeded : True
我可以毫无问题地 ping raspi。我也可以毫无问题地连接到端口 8080。 知道为什么与端口 1600 的连接失败吗?
正如@SKi 所建议的,问题可能来自尝试连接到 IPv6 地址而不是您正在收听的 IPv4 地址。相反,您可以尝试输入 IPv4 地址 10.3.10.200
作为 "ComputerName" 以将测试限制为 IPv4。