2013-10-03 69 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等)