DatagramSocket multicast loopback setting

Hi Juce foks,

I Was just wondering if you could possibly add a function to SocketHelpers (and DatagramSocket) that allows us to enable / disable multicast loopback?

It would only need to be simple, something like:

static bool multicastLoopback (int handle, bool loopback) noexcept
    int opt = (int)loopback;
    return setsockopt(handle,
                      (char *)&opt,
                      sizeof(opt)) == 0;


 /** Enable or disable multicast loopback
 @returns true if it succeeds.
bool enableMulticastLoopback (bool loopback);

bool DatagramSocket::enableMulticastLoopback (bool loopback)
    if (! isBound || handle < 0)
        return false;

    return SocketHelpers::multicastLoopback(handle, false);

Would just make DatagramSocket that slight bit more versatile :slight_smile:

Sure, will add that.


1 Like