Mountaineer Ethernet UDP send Example?

Hello,

i’m trying to send udp-packets over my mountaineer ethernet board, but i’m getting an exception while sending the packet.

My Code:


private void InitEthernet()
        {
            ethernetForMountaineerEth.UseStaticIP("192.168.10.10", "255.255.255.0", "192.168.10.1");
            ethernetForMountaineerEth.NetworkUp += new GTM.Module.NetworkModule.NetworkEventHandler(Ethernet_NetworkUp);
        }

        private void SendUdpCommand(string command)
        {
            System.Net.Sockets.Socket socket = new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

            IPAddress destinationIP = new IPAddress(new byte[] { 192, 168, 10, 125 });
            IPEndPoint destinationEndPoint = new IPEndPoint(destinationIP, 5000);
            Byte[] sendBytes = Encoding.UTF8.GetBytes(command);
            try
            {
                //socket.Bind(destinationEndPoint);
                socket.SendTo(sendBytes, destinationEndPoint);   <----------------Exception here. The same with the bind method.
            }
            catch(Exception exc)
            {
                Debug.Print(exc.ToString());
            }
            
        }

Hope someone can help me. I am using NETFM4.2(QEF2).

It a System.Net.Sockets.SocketException.

Stacktrace:
Microsoft.SPOT.Net.SocketNative::sendto
System.Net.Sockets.Socket::SendTo
System.Net.Sockets.Socket::SendTo
MountaineerTest11.Program::SendUdpCommand
MountaineerTest11.Program::ButtonTimer_Tick
Gadgeteer.Timer::dt_Tick
Microsoft.SPOT.DispatcherTimer::FireTick
Microsoft.SPOT.Dispatcher::PushFrameImpl
Microsoft.SPOT.Dispatcher::PushFrame
Microsoft.SPOT.Dispatcher::Run
Gadgeteer.Program::Run
MountaineerTest11.Program::Main

I’ve found my problem. I’ve connected the Mountaineer directly to a Brightsign AV-Player and somehow i cannot send udp packets directly. Sendin packages over a switch works without problems.

My FEZ Spider doesn’t seem to have problems sending packages directly…