src/libtsduck/base/network/tsUDPSocket.cpp
bool ts::UDPSocket::setBroadcastIfRequired(const IPAddress destination, Report& report)
{
    // Get all local interfaces.
    IPAddressMaskVector locals;
    if (!GetLocalIPAddresses(locals, report)) {
        return false;
    }

    // Loop on all local addresses and set broadcast when we match a local broadcast address.
    for (auto it = locals.begin(); it != locals.end(); ++it) {
        if (destination == it->broadcastAddress()) {
            return setBroadcast(true, report);
        }
    }

    // Not a broadcast address, nothing was done.
    return true;
}
//----------------------------------------------------------------------------
// Enable or disable the broadcast option, based on an IP address.
//----------------------------------------------------------------------------
Enable or disable the broadcast option, based on an IP address.
Enable or disable the broadcast option based on an IP address .
bool ts::UDPSocket::setBroadcastIfRequired(const IPAddress destination, Report& report)
{
    IPAddressMaskVector locals;
    if (!GetLocalIPAddresses(locals, report)) {
        return false;
    }
    for (auto it = locals.begin(); it != locals.end(); ++it) {
        if (destination == it->broadcastAddress()) {
            return setBroadcast(true, report);
        }
    }
    return true;
}
bool ts :: UDPSocket :: setBroadcastIfRequired ( const IPAddress destination , Report & report ) { IPAddressMaskVector locals ; if ( ! GetLocalIPAddresses ( locals , report ) ) { return false ; } for ( auto it = locals . begin ( ) ; it != locals . end ( ) ; ++ it ) { if ( destination == it -> broadcastAddress ( ) ) { return setBroadcast ( true , report ) ; } } return true ; }
Enable or disable the broadcast option, based on an IP address.
Enable or disable the broadcast option based on an IP address .
// Get all local interfaces. // Loop on all local addresses and set broadcast when we match a local broadcast address. // Not a broadcast address, nothing was done.