I have a UDP server which binds to a well-known port, adds itself to a multicast group and listens for requests for clients. (The server is on Windows, and uses WSARecvFrom to issue an overlapped receive for client datagrams.) Clients send messages to the server at its well-known port and multicast IP address.
When testing the 'server' on a laptop, I have noticed that if the laptop enters a 'sleep' state the server's receiving socket becomes 'unbound' from the multicast address (so that client sends to the multicast address are no-longer received). However, the socket is still receiving in that a send to its port at 127.0.0.1 is still received - and Windows does not indicate any error. (The server socket is bound to INADDR_ANY.)
The 'server' is part of a peer-to-peer application, used for auto-discovery - so this situation is not as unusual as might be expected.
Can you suggest a way to determine whether the server is still actively listening on the multicast address without sending to the multicast address (which would result in unnecessary traffic to all 'servers' on the network)? One possible solution would be to send to the IP address of the adapter used for multicast, but I'm not sure how to determine this.