예제 #1
0
 int JackNetMasterInterface::Recv ( size_t size, int flags )
 {
     int rx_bytes;
     if ( ( ( rx_bytes = fSocket.Recv ( fRxBuffer, size, flags ) ) == SOCKET_ERROR ) && fRunning )
     {
         net_error_t error = fSocket.GetError();
         //no data isn't really a network error, so just return 0 avalaible read bytes
         if ( error == NET_NO_DATA )
             return 0;
         else if ( error == NET_CONN_ERROR )
         {
             //fatal connection issue, exit
             jack_error ( "'%s' : %s, exiting.", fParams.fName, StrError ( NET_ERROR_CODE ) );
             //ask to the manager to properly remove the master
             Exit();
             
             // UGLY temporary way to be sure the thread does not call code possibly causing a deadlock in JackEngine.
             ThreadExit();
         }
         else
             jack_error ( "Error in master receive : %s", StrError ( NET_ERROR_CODE ) );
     }
     
     packet_header_t* header = reinterpret_cast<packet_header_t*>(fRxBuffer);
     PacketHeaderNToH(header, header);
     return rx_bytes;
 }
예제 #2
0
    int JackNetMasterInterface::Recv(size_t size, int flags)
    {
        int rx_bytes;

        if (((rx_bytes = fSocket.Recv(fRxBuffer, size, flags)) == SOCKET_ERROR) && fRunning) {
            FatalRecvError();
        }
  
        packet_header_t* header = reinterpret_cast<packet_header_t*>(fRxBuffer);
        PacketHeaderNToH(header, header);
        return rx_bytes;
    }
예제 #3
0
    int JackNetSlaveInterface::Recv(size_t size, int flags)
    {
        int rx_bytes = fSocket.Recv(fRxBuffer, size, flags);
        
        // handle errors
        if (rx_bytes == SOCKET_ERROR) {
            FatalRecvError();
        }

        packet_header_t* header = reinterpret_cast<packet_header_t*>(fRxBuffer);
        PacketHeaderNToH(header, header);
        return rx_bytes;
    }
예제 #4
0
 int JackNetSlaveInterface::Recv ( size_t size, int flags )
 {
     int rx_bytes = fSocket.Recv ( fRxBuffer, size, flags );
     //handle errors
     if ( rx_bytes == SOCKET_ERROR )
     {
         net_error_t error = fSocket.GetError();
         //no data isn't really an error in realtime processing, so just return 0
         if ( error == NET_NO_DATA )
             jack_error ( "No data, is the master still running ?" );
         //if a network error occurs, this exception will restart the driver
         else if ( error == NET_CONN_ERROR )
         {
             jack_error ( "Connection lost." );
             throw JackNetException();
         }
         else
             jack_error ( "Fatal error in slave receive : %s", StrError ( NET_ERROR_CODE ) );
     }
     
     packet_header_t* header = reinterpret_cast<packet_header_t*>(fRxBuffer);
     PacketHeaderNToH(header, header);
     return rx_bytes;
 }