Joe,
Yes, the W5100 works fine AFAIK because I have built and run the sample server application provided. I can access the server in the example without problem and the application I am writing works great as long as I am stepping through the code rather than running it normally. Here is the method I am having trouble with and the configuration I’m using:
Setup in Main():
byte[] ip = { 10, 0, 1, 25 };
byte[] subnet = { 255, 255, 255, 0 };
byte[] gateway = { 10, 0, 1, 1 };
byte[] mac = { 43, 185, 44, 2, 206, 127 };
WIZnet_W5100.Enable(SPI.SPI_module.SPI1, (Cpu.Pin)FEZ_Pin.Digital.Di6, (Cpu.Pin)FEZ_Pin.Digital.Di7, true);
NetworkInterface.EnableStaticIP(ip, subnet, gateway, mac);
NetworkInterface.EnableStaticDns(new byte[] { 10, 0, 1, 1 });
string response = request("http://209.20.72.170/publicapi/add/?apikey=2c5...c9&priority=0&application=StudioMonitor&event=Button Pushed&Description=Pushed", "");
The request method mentioned above parses out the relevant data from the url and calls the below method to create the socket connection.
Method:
private static Socket ConnectSocket(String server, Int32 port)
{
IPAddress theIP = IPAddress.Parse(server);
// Create socket and connect to the server's IP address and port
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.ReceiveTimeout = 10000;
socket.SendTimeout = 10000;
socket.Connect(new IPEndPoint(theIP, port));
return socket;
}
This invariable ends badly in
An unhandled exception of type ‘System.Exception’ occurred in GHIElectronics.NETMF.W5100.dll
Additional information: Timeout occurs during connection establishment
and the system refers to the “socket.Connect()” line as the one causing the exception.
NOTE: I added in the socket.ReceiveTimeout = 10000; and socket.SendTimeout = 10000; just to see if it had any effect. It didn’t.
I would LOVE your feedback.