2013-10-03 104 views
0

我试图运行How to create and use a TCP socket client app for Windows Phone但得到以下错误...System.IO.FileNotFoundException Windows Phone中运行TCP客户端的Socket教程时8

An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary 
An exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll and wasn't handled before a managed/native boundary 
An exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll and wasn't handled before a managed/native boundary 
An exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll and wasn't handled before a managed/native boundary 
An exception of type 'System.Net.Sockets.SocketException' occurred in System.Net.ni.dll and wasn't handled before a managed/native boundary 

我已经在运行简单IP服务我dev电脑和调试时通过USB连接电话。它并不文章你应该使用的IP地址,从手机到dev的电脑提示 - 我已经试过了,

192.168.1.66 // Dev computer address on lan 
whitby  // Dev computer name 
127.0.0.1 // Localhost, refers to dev computer or phone? 
localhost // ditto 

我猜还有,如果主机是错的,我会得到一个不错的错误信息 - 相反,没有什么(即空字符串)从e.SocketError.ToString()

我使用的Windows Phone 8

回答

0

其实,我已经想通了回显。我习惯了Windows Phone 7编程,而且似乎系统库在Windows Phone 8中当然会抛出异常 - 应用程序会继续运行。

问题在于防火墙阻塞了简单IP服务端口。为了得到工作,你可以暂时禁用Windows防火墙:在开始菜单

  • 类型“防火墙”“具有高级安全性的Windows防火墙”客户端来获取
  • 单击“Windows防火墙属性”
  • 在'Private Profile'选项卡下,暂时将'Firewall State'设置为'Off'

然后使用dev计算机的IP连接192.168.1.66(非localhost,127.0.0.1等)