【发布时间】:2014-05-25 16:14:30
【问题描述】:
我用过这个link。当我尝试连接两台不同的机器 192.168.1.4 和 192.168.1.9 时。我在服务器代码中更改了这部分
TcpListener myList = new TcpListener(IPAddress.Any, 27505);
而不是
IPAddress ipAd = IPAddress.Parse("192.168.1.9");
TcpListener myList = new TcpListener(ipAd, 27505);
我在客户端收到此错误
Unhandled Exception: System.Net.Sockets.SocketException: A connection attempt fa
iled because the connected party did not properly respond after a period of time
, or established connection failed because connected host has failed to respond
192.168.1.4:8001
at System.Net.Sockets.TcpClient.Connect(String hostname, Int32 port)
at Client.Client.send() in C:\Users\John\Documents\Visual Studio 2010\Project
s\Server Client\Client\Client.cs:line 111
at Client.Client.Main(String[] args) in C:\Users\John\Documents\Visual Studio
2010\Projects\Server Client\Client\Client.cs:line 147
我尝试在同一台机器上同时运行它们,并且成功了。 如何解决?
【问题讨论】:
-
缺少错误。请修复,以便我们诊断问题。
-
这不是错误,它只是错误附带的堆栈跟踪的一小部分。
-
抱歉,David 我没注意到,我已经编辑过了
-
我发现问题出在我的windows防火墙上,我不知道如何关闭这个问题。非常感谢大家
标签: c# tcp client-server