FEZConnectShieldが接続されたFEZDominoを使用しています。これは、イーサネットポートを介してラップトップのサーバーアプリケーションに接続しようとしている私のコードです。
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を実行でき、応答するので、サーバーアプリケーションに問題はないと思います。
助けてください