src/libtsduck/base/network/tsUDPSocket.cpp
bool ts::UDPSocket::receive(void* data,
                            size_t max_size,
                            size_t& ret_size,
                            SocketAddress& sender,
                            SocketAddress& destination,
                            const AbortInterface* abort,
                            Report& report)
{
    // Loop on unsollicited interrupts
    for (;;) {

        // Wait for a message.
        const SocketErrorCode err = receiveOne(data, max_size, ret_size, sender, destination, report);

        if (abort != nullptr && abort->aborting()) {
            // Aborting, no error message.
            return false;
        }
        else if (err == SYS_SUCCESS) {
            // Sometimes, we get "successful" empty message coming from nowhere. Ignore them.
            if (ret_size > 0 || sender.hasAddress()) {
                return true;
            }
        }
        else if (abort != nullptr && abort->aborting()) {
            // User-interrupt, end of processing but no error message
            return false;
        }
#if !defined(TS_WINDOWS)
        else if (err == EINTR) {
            // Got a signal, not a user interrupt, will ignore it
            report.debug(u"signal, not user interrupt");
        }
#endif
        else {
            // Abort on non-interrupt errors.
            report.error(u"error receiving from UDP socket: %s", {SocketErrorCodeMessage(err)});
            return false;
        }
    }
//----------------------------------------------------------------------------
// Receive a message.
// If abort interface is non-zero, invoke it when I/O is interrupted
// (in case of user-interrupt, return, otherwise retry).
// Return true on success, false on error.
//----------------------------------------------------------------------------
Receive a message.
If abort interface is non-zero, invoke it when I/O is interrupted
(in case of user-interrupt, return, otherwise retry).
Return true on success, false on error.
Receive a message . If abort interface is non - zero invoke it when I / O is interrupted ( in case of user - interrupt return otherwise retry ) . Return true on success false on error .
bool ts::UDPSocket::receive(void* data,
                            size_t max_size,
                            size_t& ret_size,
                            SocketAddress& sender,
                            SocketAddress& destination,
                            const AbortInterface* abort,
                            Report& report)
{
    for (;;) {
        const SocketErrorCode err = receiveOne(data, max_size, ret_size, sender, destination, report);
        if (abort != nullptr && abort->aborting()) {
            return false;
        }
        else if (err == SYS_SUCCESS) {
            if (ret_size > 0 || sender.hasAddress()) {
                return true;
            }
        }
        else if (abort != nullptr && abort->aborting()) {
            return false;
        }
#if !defined(TS_WINDOWS)
        else if (err == EINTR) {
            report.debug(u"signal, not user interrupt");
        }
#endif
        else {
            report.error(u"error receiving from UDP socket: %s", {SocketErrorCodeMessage(err)});
            return false;
        }
    }
bool ts :: UDPSocket :: receive ( void * data , size_t max_size , size_t & ret_size , SocketAddress & sender , SocketAddress & destination , const AbortInterface * abort , Report & report ) { for ( ; ; ) { const SocketErrorCode err = receiveOne ( data , max_size , ret_size , sender , destination , report ) ; if ( abort != nullptr && abort -> aborting ( ) ) { return false ; } else if ( err == SYS_SUCCESS ) { if ( ret_size > 0 || sender . hasAddress ( ) ) { return true ; } } else if ( abort != nullptr && abort -> aborting ( ) ) { return false ; } #if ! defined ( TS_WINDOWS ) else if ( err == EINTR ) { report . debug ( u" " ) ; } #endif else { report . error ( u" " , { SocketErrorCodeMessage ( err ) } ) ; return false ; } }
Receive a message.
Receive a message .
// Loop on unsollicited interrupts // Wait for a message. // Aborting, no error message. // Sometimes, we get "successful" empty message coming from nowhere. Ignore them. // User-interrupt, end of processing but no error message // Got a signal, not a user interrupt, will ignore it // Abort on non-interrupt errors.