I am a hardware test engineer. I have a DUT (device under test) connected to my PC via third party USB to SPI bridge. They provided me with native C library for this bridge and it is not bad as a starting point. I've implemented .Net wrapper and can control my device. The problem is that this library is very limited in functionality so I need to create another one.
I got instruction from them:
You have to develop some sort of application which uses UDP sockets.
In that application you must open socket to:
UDP Port : 4345
I've made simple program to send and receive data to and from my DUT:
        IPEndPoint endPOint = new IPEndPoint(IPAddress.Parse(""), 4345);
        Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
        server.ReceiveTimeout = 10000;
            byte[] data = new byte[] { 0x04, 0xf0, 0xff, 0xff, 0x55, 0x00, 0x00, 0x00, 0x00 };
            server.SendTo(data, endPOint);
            EndPoint sender = (EndPoint)endPOint;
            int count = 0;
            server.ReceiveFrom(data, ref sender);
        catch (SocketException ex)
I can send command to the device but can not catch any response. Network analyzer shows the next: => (Len 37) UDP: port 4238 => 4345 Generic Data => (Len 37) UDP: port 4345 => 4345 Generic Data => (Len 50) UDP: port 4345 => 4345 Generic Data
First line is "RESEST" command to my DUT, second one is DUT request for firmware upload and third is DUT "BOOTING" report. I have to wait this report to start DUT configuration and testing. I can not catch it. server. ReceiveFrom(data, ref sender) method ends with Timeout Exception.
Network programming is new for me so I would be very appreciated for any help.
I've tried this example:
Sending data on UDP connection
It meant to be a classic UPD test. But it doesn't work. I just copied code. In this example
recv = s.ReceiveFrom(data, ref Remote);
throws a "An existing connection was forcibly closed by the remote host UDP" exception.