Hi,
I’ve got the following test code on my device and when I attempt to broadcast a UDP packet on the network, it blocks at the SendTo line. I have references to FezDomino_GhiElectronics.NetMF.Fez, GHIElectronics.NETMF.Net and GHIElectronics.NETMF.W5100 and I’m using the pin compatible Arduino Ethernet shield.
Had all this running before but can’t figure out what changed;
using System;
using System.Threading;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Net;
using GHIElectronics.NETMF.Net.Sockets;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
namespace FEZ_Domino_Application1
{
public class Program
{
public static void Main()
{
bool ledState = false;
OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, ledState);
while (true)
{
Thread.Sleep(500);
ledState = !ledState;
led.Write(ledState);
Debug.Print(DateTime.Now.ToString());
byte[] messageBytes = { 20, 30, 40, 0 };
using (Socket clientSocket = new Socket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp))
{
// Addressing
IPHostEntry entry = Dns.GetHostEntry("255.255.255.255"); // UDP broadcast address for local network.
IPAddress ipAddress = entry.AddressList[0];
IPEndPoint serverEndPoint = new IPEndPoint(ipAddress, 2000);
Debug.Print("sock");
// Blocks here, UDP is connectionless so I'm guessing I have a wrong library?
clientSocket.SendTo(messageBytes, serverEndPoint);
Debug.Print("sockend");
}
}
}
}
}
This is a brand new project, so no old duff references in there (hopefully).