I am having trouble just doing a simple socket test with my ChipworkX development system. I took some sample code from one of the many examples and it worked fine on the emulator but not on the device itself. Below is the example code. When running on the device I always get this error on the connect method of the socket. I tried another simple example and it worked on the emulator fine, but again failed on the device with the same error. I also put a break point before the connect method to make sure the device picked up and IP address and the DNS addresses. It did and you could also ping the device from another computer on the network.
A first chance exception of type ‘System.Net.Sockets.SocketException’ occurred in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10038
#### SocketException ErrorCode = 10038
code sample below*************************
NetworkInterface[] nic = NetworkInterface.GetAllNetworkInterfaces();
nic[0].EnableDhcp();
nic[0].ReleaseDhcpLease();
nic[0].RenewDhcpLease();
IPHostEntry hostEntry = Dns.GetHostEntry(“www.pachube.com”);
IPAddress hostAddress = hostEntry.AddressList[0];
IPEndPoint remoteEndPoint = new IPEndPoint(hostAddress, 80);
Debug.Print(“Connect…”);
Socket connection = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
try
{
connection.Connect(remoteEndPoint);
Debug.Print("Connection Successful");
}
catch (SocketException ex)
{
Debug.Print(ex.Message + "; " + ex.InnerException);
}
connection.SetSocketOption(SocketOptionLevel.Tcp,SocketOptionName.NoDelay, true);
connection.SendTimeout = 5000;
connection.Close();
connection = null;