the server could remove them when the send fails
That won't work. The send won't fail if the receiver stops receiving. You need some explicit disconnection mechanism.
- send doesn't wait for the datagram to be sent and acknowledged, so at best you'd know if a past send failed.
- There's no connection to keep track of a past send failures.
- There's no acknowledgment sent by the remote end to say it didn't fail.
The send will only fail if there's a local error (e.g. bad argument, no more resources, etc)
Kudos for IO::Socket::Multicast, though