2012-09-27 47 views
0

我正在使用FEZ Domino並附上FEZ Connect Shield。這是我的代碼試圖通過以太網端口連接到服務器應用程序在我的筆記本:嘗試使用Fez Connect Shield連接服務器時的連接時序

private const string ServerIPAddress = "192.168.153.206"; 
private const int port = 2000; 

WIZnet_W5100.Enable(SPI.SPI_module.SPI1, (Cpu.Pin)FEZ_Pin.Digital.Di10,(Cpu.Pin)FEZ_Pin.Digital.Di7, true);   

using(var clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) 
{ 
    IPHostEntry entry = Dns.GetHostEntry(ServerIPAddress); 
    IPAddress ipAddress = entry.AddressList[0]; 
    IPEndPoint serverEndPoint = new IPEndPoint(ipAddress, port); 

    Debug.Print("Connecting to server: " + serverEndPoint + "."); 

    clientSocket.SendTimeout = 3000; 
    clientSocket.Connect(serverEndPoint); 

    Debug.Print("Connected to server"); 

    byte[] msg = Encoding.UTF8.GetBytes("Hello"); 
    clientSocket.Send(msg); 
} 

在「clientSocket.Connect(serverEndPoint)」我得到這個異常:

An unhandled exception of type "System.Exception" occurred in GHIElectronics.NETMF.W5100.dll 
Additional information: Timeout occurs during connection establishment 

當我連接我的筆記本電腦到另一臺筆記本電腦,我可以ping服務器應用程序,它會迴應,所以我相信問題不在服務器應用程序上。

幫助請

+0

你的筆記本電腦可以做一個引黃到2000端口? – BugFinder

+0

是的,我可以,從laptop2我使用谷歌瀏覽器,並在地址欄中鍵入「192.168.153.206:2000」,並獲得一個簡單的頁面 –

+0

Debug.Print(「連接到服務器:...線似乎有正確的信息? – CrazyCasta

回答

0

我發現這個問題,看來你必須給菲斯連接屏蔽IP地址,子網掩碼和網關:)

相關問題