0
votes

I have a "Director" program which broadcasts an M-SEARCH request over a local net. There are four servers in the net, each running the same "Responder" program which should identify the server with an HTTP response.

    IPEndPoint groupEP = new IPEndPoint(IPAddress.Any, SSDP_PORT);
    client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
    client.Client.Bind(groupEP);

Sometimes one or more of the Responders will stall on the Receive action

            RequestorEP = null;
            byte[] buffer = client.Receive(ref RequestorEP);

Wireshark shows the M-SEARCH messages coming across the net but sometimes the program never appears to read them.

The Servers run Windows 10 and are equipped with two active Ethernet cards connected to different local nets.

The Responder is written in C#.

Any ideas on what to look for next?

1
Are you sending and receiveing on the same or different ports? Also, since you are not using async that Read() will block on while waiting for response. That is why asked if the incoming data is on the port you are expecting, also is it possible that your server has disconnected/reconnected during transmission?Ross Bush
I am sending and receiving on the same port (1900). The read is supposed to block as this action is done in a worker thread. I have tried reading with a timeout and looping. The "Director" keeps sending M-SEARCH requests until it gets a reply from each server. 3 of the 4 servers respond. One does not. I can see the M-SEARCH requests arriving on the offending server with Wireshark. I cannot tell why the "Responder" does not read them.Mike Pettigrew
Deleting the network device and reloading it provided a temporary fix to the problem. However, the problem may reoccur on the next reboot.Mike Pettigrew
The problem seems to be related to systems with multiple Ethernet cards. Does not happen with single-card systems. Gave up and used fixed IP assignments for the servers as they require dual NICs. A deadline is coming up.Mike Pettigrew

1 Answers

0
votes

As it turned out, this question has a workable answer here: UDP: Read data from all network interfaces

Too bad I did not spot it earlier. Well, there will always be the next release...