Main Site Documentation

Problem connecting the ChipWorkX development system to the internet


#1

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;


#2

I suggest that you try to get it working with static IP first.
You can set the IP address through MFDeploy or through the code. After setting the IP address, check if you can ping the ip address from any station on your network. command prompt -> ping xx.xx.xx.xx


#3

It worked using static IP. I also did a basic WebRequest and WebResponse test with a web service on the internet and it worked as well. Thank you!

Any ideas why it won’t work in DHCP mode now? This will allow me to continue to test, but using DHCP will be much more valuable for what I am trying to do in the long run. Thanks.


#4

rncox, try the example from the ebook it worked straight off for me and I based my connection model for Pyxis after it. Another thing you’ll want to make sure is you have external power hooked up to the board. ChipworkX draws a lot of power and I’ve found I simple cannot use the ethernet jack without having external power.


#5

What is your router (DHCP server) brand and model number?
Can you try chipworkX with different network with different dhcp server?