当前位置: 首页>>代码示例>>C++>>正文


C++ RTP_DEBUG_OUTPUT_STR函数代码示例

本文整理汇总了C++中RTP_DEBUG_OUTPUT_STR函数的典型用法代码示例。如果您正苦于以下问题:C++ RTP_DEBUG_OUTPUT_STR函数的具体用法?C++ RTP_DEBUG_OUTPUT_STR怎么用?C++ RTP_DEBUG_OUTPUT_STR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RTP_DEBUG_OUTPUT_STR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rtp_net_setreuseaddr

/*----------------------------------------------------------------------*
                           rtp_net_setreuseaddr
 *----------------------------------------------------------------------*/
int rtp_net_setreuseaddr (RTP_HANDLE sockHandle, unsigned int onBool)
{
#ifdef LINUXTOBEIMPLEMENTED
#ifdef RTP_DEBUG
    int result;
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    WSASetLastError (0);
#endif

    if ( setsockopt((SOCKET) sockHandle, SOL_SOCKET, SO_REUSEADDR, (char *) &onBool, sizeof (int)) == SOCKET_ERROR )
    {
#ifdef RTP_DEBUG
        result = WSAGetLastError();
        RTP_DEBUG_OUTPUT_STR("rtp_net_setreuseaddr: error returned ");
        RTP_DEBUG_OUTPUT_INT(result);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }
    return (0);
#else
    return (0);
#endif
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:30,代码来源:rtpnet.c

示例2: rtp_net_setnagle

/*----------------------------------------------------------------------*
                            rtp_net_setnagle
 *----------------------------------------------------------------------*/
int rtp_net_setnagle (RTP_HANDLE sockHandle, unsigned int onBool)
{
#ifdef LINUXTOBEIMPLEMENTED
    int option;

#ifdef RTP_DEBUG
    int result;
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    WSASetLastError (0);
#endif

    option = (int)(!onBool);
    if ( setsockopt((SOCKET) sockHandle, IPPROTO_TCP, TCP_NODELAY, (char *) &option, sizeof (int)) == SOCKET_ERROR )
    {
#ifdef RTP_DEBUG
        result = WSAGetLastError();
        RTP_DEBUG_OUTPUT_STR("rtp_net_setnagle: error returned ");
        RTP_DEBUG_OUTPUT_INT(result);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }
    return (0);
#else
    return (0);
#endif
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:33,代码来源:rtpnet.c

示例3: rtp_file_get_free

/*----------------------------------------------------------------------*
                           rtp_file_get_free
 *----------------------------------------------------------------------*/
int rtp_file_get_free (const char * name, unsigned long *total, unsigned long *free,
                       unsigned long *sectors_per_unit, unsigned short *bytes_per_sector)
{
    struct statfs stats;

#ifdef RTP_DEBUG
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    errno = 0;
#endif

    if (statfs ((const char *) name, &stats) != 0)
    {
#ifdef RTP_DEBUG
        RTP_DEBUG_OUTPUT_STR("rtp_file_get_free: error returned ");
        RTP_DEBUG_OUTPUT_INT(errno);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }

    *total = (unsigned long) stats.f_blocks;
    *free  = (unsigned long) stats.f_bavail;
    *sectors_per_unit = (unsigned long)  1;
    *bytes_per_sector = (unsigned short) stats.f_bsize;

    return (0);
}
开发者ID:layerfsd,项目名称:cifssmb,代码行数:33,代码来源:rtpfile.c

示例4: rtp_net_setblocking

/*----------------------------------------------------------------------*
                           rtp_net_setblocking
 *----------------------------------------------------------------------*/
int rtp_net_setblocking (RTP_HANDLE sockHandle, unsigned int onBool)
{
#ifdef LINUXTOBEIMPLEMENTED
    u_long arg;

#ifdef RTP_DEBUG
    int result;
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    WSASetLastError (0);
#endif

    arg = (u_long)(!onBool);
    if (ioctlsocket((SOCKET) sockHandle, FIONBIO, (u_long *) &arg) == SOCKET_ERROR)
    {
#ifdef RTP_DEBUG
        result = WSAGetLastError();
        RTP_DEBUG_OUTPUT_STR("rtp_net_setblocking: error returned ");
        RTP_DEBUG_OUTPUT_INT(result);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }
    return (0);
#else
    return (0);
#endif
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:33,代码来源:rtpnet.c

示例5: rtp_file_delete

/*----------------------------------------------------------------------*
                             rtp_file_delete
 *----------------------------------------------------------------------*/
int rtp_file_delete (const char * name)
{
#ifdef RTP_DEBUG
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    errno = 0;
#endif

    if (unlink ((const char *)name) != 0)
    {
#ifdef RTP_DEBUG
        RTP_DEBUG_OUTPUT_STR("rtp_file_delete: error returned ");
        RTP_DEBUG_OUTPUT_INT(errno);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }
#ifdef RTP_DEBUG
    RTP_DEBUG_OUTPUT_STR("rtp_file_delete: ");
    RTP_DEBUG_OUTPUT_STR("...success");
    RTP_DEBUG_OUTPUT_STR(".\n");
#endif
    return (0);
}
开发者ID:layerfsd,项目名称:cifssmb,代码行数:29,代码来源:rtpfile.c

示例6: _rtp_sig_semaphore_wait_timed

/** @memo   Wait for a semaphore to be signaled.

    @doc    Wait for a semaphore to be signaled.  If the 
    semaphore has already been signaled this function returns
    immediatley, otherwise it should block until the semaphore
    is signaled or the millisecond time value has expired. 
    Use 0 to poll the signal and return with its state 
    immediately.  Use -1 to indicate that an infinite timeout
    value should be used, blocking indefinitely for the 
    signal.

	@precondition Must not call directly. Use the 
	<b>rtp_sig_semaphore_wait_timed</b> macro in rtpsignl.h.
	
    @return 0 if successful, -1 on error, and 1 if the call timed
    out.  For debugging purposes; if the cause of the error is 
    obtainable at the native Kernel layer, turn on 
    RTP_DEBUG in rtpdebug.h to display the native error 
    value.
 */
int _rtp_sig_semaphore_wait_timed (
  RTP_HANDLE semHandle,                 /** Handle to the semaphore to be checked. */
  long msecs                            /** Timeout value in milliseconds:<br>
	<pre>
|		 0   To poll.
|		-1   To indicate use of infinite.
	</pre> */
  )
{
    INT16U timeout;
    INT8U  err;
    INT16U currentCount;

    if (msecs == 0)
    {
    	currentCount = ((OS_EVENT*)semHandle)->OSEventCnt;
        if (!currentCount)
        {
          return(-1);
        }
    }
    
    if (msecs == -1)
    {
		timeout = 0;
    }
	else
	{
	    timeout  = msecs * OS_TICKS_PER_SEC / 1000;
	}
    
    OSSemPend ((OS_EVENT *) semHandle, timeout, &err);
      
    if (err == OS_NO_ERR)
    {
    	/* success, return */
    	return (0);
    }

#if (RTP_DEBUG_SIGNAL)    
    if (err == OS_TIMEOUT)
    {
    	RTP_DEBUG_OUTPUT_STR("The semaphore was not received within the specified timeout.");
    }
    if (err == OS_ERR_EVENT_TYPE)
    {
    	RTP_DEBUG_OUTPUT_STR("If you didnt pass a pointer to a semaphore.");
    }
    if (err == OS_ERR_PEND_ISR)
    {
    	RTP_DEBUG_OUTPUT_STR("If you called this function from an ISR and the result would lead to a suspension.");
    }
    if (err == OS_ERR_PEVENT_NULL)
    {
    	RTP_DEBUG_OUTPUT_STR("If pevent is a NULL pointer.");
    }
#endif   
    return (-1);
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:79,代码来源:rtpsignl.c

示例7: rtp_net_bind

/*----------------------------------------------------------------------*
                            rtp_net_bind
 *----------------------------------------------------------------------*/
int rtp_net_bind (RTP_HANDLE sockHandle, unsigned char *ipAddr, int port, int type)
{
    struct sockaddr_in sin;
    unsigned long in_addr = 0;

    memset(&sin, 0, sizeof (sin));

    if (ipAddr)
    {
        unsigned char *ptr = (unsigned char *) &in_addr;

        ptr[0] = ipAddr[0];
        ptr[1] = ipAddr[1];
        ptr[2] = ipAddr[2];
        ptr[3] = ipAddr[3];

        /* ----------------------------------- */
        /* RTP_NET_TYPE_IPV6 not yet supported */
        /* ----------------------------------- */
    }
    else
    {
        in_addr = INADDR_ANY;
    }

    sin.sin_family = AF_INET;
    sin.sin_addr.s_addr = in_addr;
    sin.sin_port = htons((unsigned short)port);

    if (bind ((int) sockHandle, (struct sockaddr *) &sin, sizeof (sin)) != 0)
    {
		int errVal = _rtp_get_last_socket_error(sockHandle);
	  
        if (errVal == EINVAL)
        {
#ifdef RTP_DEBUG
            RTP_DEBUG_OUTPUT_STR("rtp_net_bind: non-fatal error returned ");
            RTP_DEBUG_OUTPUT_INT(errVal);
            RTP_DEBUG_OUTPUT_STR(".\n");
#endif
            return (-2);
        }
        else
        {
#ifdef RTP_DEBUG
        	RTP_DEBUG_OUTPUT_STR("rtp_net_bind: error returned ");
        	RTP_DEBUG_OUTPUT_INT(errVal);
        	RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        	return (-1);
        }
    }

    return (0);
}
开发者ID:maojxsir,项目名称:upnp,代码行数:58,代码来源:rtpnet.c

示例8: rtp_net_recvfrom

/*----------------------------------------------------------------------*
                           rtp_net_recvfrom
 *----------------------------------------------------------------------*/
long rtp_net_recvfrom (RTP_HANDLE sockHandle, 
                       unsigned char *buffer, long size,
                       unsigned char *ipAddr, int *port, int *type)
{
    ssize_t result;
    int remoteLen;
    struct sockaddr_in remote;
    
    remoteLen = sizeof(remote);
    memset(&remote, 0, remoteLen);

    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    errno = 0;

    result = recvfrom((int) sockHandle, (char *) buffer, (int) size, 0, (struct sockaddr *) &remote, (int *) &remoteLen);

    if (result == -1)
    {
        if ((errno == EINTR) || (errno == EAGAIN))
        {
#ifdef RTP_DEBUG
            RTP_DEBUG_OUTPUT_STR("rtp_net_recvfrom: non-fatal error returned ");
            RTP_DEBUG_OUTPUT_INT(errno);
            RTP_DEBUG_OUTPUT_STR(".\n");
#endif
            return (-2);
        }
#ifdef RTP_DEBUG
        RTP_DEBUG_OUTPUT_STR("rtp_net_recvfrom: error returned ");
        RTP_DEBUG_OUTPUT_INT(errno);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }

    if (ipAddr)
    {
        unsigned long d = remote.sin_addr.s_addr;
        unsigned char *ptr = (unsigned char *) &d;
                
        ipAddr[0] = ptr[0];
        ipAddr[1] = ptr[1];
        ipAddr[2] = ptr[2];
        ipAddr[3] = ptr[3];
        
        *type = RTP_NET_TYPE_IPV4;
        *port = ntohs(remote.sin_port);
    }
    
    return ((long) result);
}
开发者ID:maojxsir,项目名称:upnp,代码行数:57,代码来源:rtpnet.c

示例9: rtp_net_gethostbyname

/*----------------------------------------------------------------------*
                          rtp_net_gethostbyname
 *----------------------------------------------------------------------*/
int rtp_net_gethostbyname (unsigned char *ipAddr, int *type, char *name)
{
#if (INCLUDE_DNS)
#ifdef RTP_DEBUG
    int result;
#endif
    PFHOSTENT hp = NULL;

#ifdef RTP_DEBUG
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    set_errno (0);
#endif

    if (!(hp = gethostbyname(name)))
    {
#ifdef RTP_DEBUG
        result = xn_getlasterror();
        RTP_DEBUG_OUTPUT_STR("rtp_net_gethostbyname: error returned ");
        RTP_DEBUG_OUTPUT_INT(result);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }

    if (hp->h_addrtype != AF_INET)
    {
#ifdef RTP_DEBUG
        set_errno (EAFNOSUPPORT);
        result = xn_getlasterror();
        RTP_DEBUG_OUTPUT_STR("rtp_net_gethostbyname: error returned ");
        RTP_DEBUG_OUTPUT_INT(result);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }
    *type = RTP_NET_TYPE_IPV4;

    ipAddr[0] = (unsigned char) hp->h_addr_list[0][0];
    ipAddr[1] = (unsigned char) hp->h_addr_list[0][1];
    ipAddr[2] = (unsigned char) hp->h_addr_list[0][2];
    ipAddr[3] = (unsigned char) hp->h_addr_list[0][3];


    return (0);
#else

    rtp_not_yet_implemented();
    return (-1);
#endif /* INCLUDE_DNS */
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:56,代码来源:rtpnet.c

示例10: rtp_net_read_select

/*----------------------------------------------------------------------*
                        rtp_net_read_select
 *----------------------------------------------------------------------*/
int rtp_net_read_select (RTP_HANDLE sockHandle, long msecTimeout)
{
struct timeval selectTime;
fd_set read_set;
int result;

    /* ----------------------------------- */
    /*              read list              */
    /* ----------------------------------- */
    FD_ZERO(&read_set);
    FD_SET(sockHandle, &read_set);

#ifdef RTP_DEBUG
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    set_errno (0);
#endif

    if (msecTimeout >= 0)
    {
        selectTime.tv_sec = msecTimeout / 1000;
        selectTime.tv_usec = (msecTimeout % 1000) * 1000;
        result = select(1, (PFDSET) &read_set, (PFDSET) 0, (PFDSET) 0, (PCTIMEVAL) &selectTime);
    }
    else
    {
        result = select(1, (PFDSET) &read_set, (PFDSET) 0, (PFDSET) 0, (PCTIMEVAL) NULL);
    }

 /*   if (result == 1)
 |    {
 |        if (!xn_tcp_is_read(sockHandle))
 |        {
 |            result = (-1);
 |        }
 |    }
*/
    /* if an error or if it timed out */
    if (result <= 0)
    {
#ifdef RTP_DEBUG
        result = xn_getlasterror();
        RTP_DEBUG_OUTPUT_STR("rtp_net_read_select: error returned ");
        RTP_DEBUG_OUTPUT_INT(result);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }

    return (0);
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:56,代码来源:rtpnet.c

示例11: rtp_wfile_open

/*----------------------------------------------------------------------*
                               rtp_wfile_open
 *----------------------------------------------------------------------*/
int rtp_wfile_open (RTP_HANDLE  * fdPtr, const unsigned short * name, unsigned short flag, unsigned short mode)
{

#if (_WIN32_WINNT) >= 0x0400

long fileHandle;
int result;

#ifdef RTP_DEBUG
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    SetLastError(0);
#endif

    name = (unsigned short *)_rtp_unicode_name_to_winname ((unsigned short *) name);
    fileHandle = (long) _wopen (name, _rtp_flag_to_operation(flag), _rtp_mode_to_permission(mode));

    if (fileHandle == (-1))
    {
        result = GetLastError();
        /* ----------------------------------- */
        /*  If trying to open a directory or   */
        /*  opening a read only file with      */
        /*  write privilages.  This can be     */
        /*  non-fatal if doing an open to      */
        /*  determine the existance of a       */
        /*  directory.                         */
        /* ----------------------------------- */
        if (result == ERROR_ACCESS_DENIED)
        {
#ifdef RTP_DEBUG
            RTP_DEBUG_OUTPUT_STR("rtp_wfile_open: non-fatal error returned ");
            RTP_DEBUG_OUTPUT_INT(result);
            RTP_DEBUG_OUTPUT_STR(".\n");
#endif
            return (-2);
        }
#ifdef RTP_DEBUG
        RTP_DEBUG_OUTPUT_STR("rtp_wfile_open: error returned ");
        RTP_DEBUG_OUTPUT_INT(result);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }
    *fdPtr = (RTP_HANDLE) fileHandle;
    return (0);

#endif
	return (-1);
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:55,代码来源:rtpwfile.c

示例12: rtp_net_recvfrom

/*----------------------------------------------------------------------*
                           rtp_net_recvfrom
 *----------------------------------------------------------------------*/
long rtp_net_recvfrom (RTP_HANDLE sockHandle,
                       unsigned char *buffer, long size,
                       unsigned char *ipAddr, int *port, int *type)
{
    long result;
    int remoteLen;
    struct sockaddr_in remote;

    remoteLen = sizeof (remote);
    memset (&remote, 0, remoteLen);

    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    set_errno (0);

    result = (long) recvfrom ((int) sockHandle, (PFCHAR) buffer, (int) size, 0, (PSOCKADDR) &remote, (PFINT) &remoteLen);

    if (result < 0)
    {
        result = (long) xn_getlasterror();
        if ((result == EINPROGRESS) || (result == EWOULDBLOCK))
        {
        	RTP_DEBUG_OUTPUT_STR("rtp_net_recvfrom: non-fatal error returned ");
        	RTP_DEBUG_OUTPUT_INT(result);
        	RTP_DEBUG_OUTPUT_STR(".\n");
            return (-2);
        }
        RTP_DEBUG_OUTPUT_STR("rtp_net_recvfrom: error returned ");
        RTP_DEBUG_OUTPUT_INT(result);
        RTP_DEBUG_OUTPUT_STR(".\n");
        return (-1);
    }

    if (ipAddr)
    {
        unsigned long d = remote.sin_addr.s_addr;
        unsigned char *ptr = (unsigned char *) &d;

        ipAddr[0] = ptr[0];
        ipAddr[1] = ptr[1];
        ipAddr[2] = ptr[2];
        ipAddr[3] = ptr[3];

        *type = RTP_NET_TYPE_IPV4;
        *port = ntohs (remote.sin_port);
    }

    return (result);
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:54,代码来源:rtpnet.c

示例13: rtp_net_getsockname

/*----------------------------------------------------------------------*
                          rtp_net_getsockname
 *----------------------------------------------------------------------*/
int rtp_net_getsockname (RTP_HANDLE sockHandle, unsigned char *ipAddr, int *port, int *type)
{
    struct sockaddr_in localAddr;
    int localLen;
#ifdef RTP_DEBUG
    int result;
#endif

    localLen = sizeof (localAddr);
    memset(&localAddr, 0, localLen);

#ifdef RTP_DEBUG
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    set_errno (0);
#endif

    if (getsockname ((int) sockHandle, (PSOCKADDR) &localAddr, (PFINT) &localLen) != 0)
    {
#ifdef RTP_DEBUG
        result = xn_getlasterror();
        RTP_DEBUG_OUTPUT_STR("rtp_net_getsockname: error returned ");
        RTP_DEBUG_OUTPUT_INT(result);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }

    if (ipAddr)
    {
        unsigned long d = localAddr.sin_addr.s_addr;
        unsigned char *ptr = (unsigned char *) &d;

        *type = RTP_NET_TYPE_IPV4;

        ipAddr[0] = ptr[0];
        ipAddr[1] = ptr[1];
        ipAddr[2] = ptr[2];
        ipAddr[3] = ptr[3];
    }

    if (port)
    {
        *port = ntohs (localAddr.sin_port);
    }

    return (0);
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:53,代码来源:rtpnet.c

示例14: _rtp_sig_semaphore_wait_timed

/*----------------------------------------------------------------------*
                       _rtp_sig_semaphore_wait_timed
 *----------------------------------------------------------------------*/
int _rtp_sig_semaphore_wait_timed (RTP_HANDLE semHandle, long msecs)
{
#ifdef LINUXTOBEIMPLEMENTED
    DWORD result;

#ifdef RTP_DEBUG
    int  err;
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    SetLastError (0);
#endif

    if (msecs == (-1))
    {
        result = WaitForSingleObject((HANDLE)semHandle, INFINITE);
    }
    else
    {
        result = WaitForSingleObject((HANDLE)semHandle, msecs);
    }
    
    if (result == WAIT_FAILED)
    {
#ifdef RTP_DEBUG
        err = GetLastError();
        RTP_DEBUG_OUTPUT_STR("rtp_sig_semaphore_wait_timed: error returned ");
        RTP_DEBUG_OUTPUT_INT(err);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }
    else if (result == WAIT_ABANDONED)
    {
#ifdef RTP_DEBUG
        RTP_DEBUG_OUTPUT_STR("rtp_sig_semaphore_wait_timed: wait abandoned.\n");
#endif
        return (-1);
    }
    else if (result == WAIT_TIMEOUT)
    {
        return (-1);
    }
    
    return (0);
#else
    return (0);
#endif
}
开发者ID:maojxsir,项目名称:upnp,代码行数:53,代码来源:rtpsignl.c

示例15: rtp_net_read_select

/*----------------------------------------------------------------------*
                        rtp_net_read_select
 *----------------------------------------------------------------------*/
int rtp_net_read_select (RTP_HANDLE sockHandle, long msecTimeout)
{
#ifdef LINUXTOBEIMPLEMENTED
struct timeval selectTime;
fd_set read_set;
int result;
    
    /* ----------------------------------- */
    /*              write list             */
    /* ----------------------------------- */
	FD_ZERO(&read_set);
    FD_SET((SOCKET) sockHandle, &read_set);

#ifdef RTP_DEBUG
    /* ----------------------------------- */
    /*  Clear the error state by setting   */
    /*  to 0.                              */
    /* ----------------------------------- */
    WSASetLastError(0);
#endif

	if (msecTimeout >= 0)
    {
        selectTime.tv_sec = msecTimeout / 1000;
        selectTime.tv_usec = (msecTimeout % 1000) * 1000;
		result = select(1, (fd_set *) &read_set, (fd_set *) 0, (fd_set *) 0, (const struct timeval *) &selectTime);
    }
	else
	{
		result = select(1, (fd_set *) &read_set, (fd_set *) 0, (fd_set *) 0, (const struct timeval *) NULL);
	}

    /* if an error or if it timed out */
    if ((result == SOCKET_ERROR) || (result == 0))
    {
#ifdef RTP_DEBUG
        result = WSAGetLastError();
        RTP_DEBUG_OUTPUT_STR("rtp_net_read_select: error returned ");
        RTP_DEBUG_OUTPUT_INT(result);
        RTP_DEBUG_OUTPUT_STR(".\n");
#endif
        return (-1);
    }
    
    return (0);
#else
	return (0);
#endif
}
开发者ID:maojxsir,项目名称:upnp,代码行数:52,代码来源:rtpnet.c


注:本文中的RTP_DEBUG_OUTPUT_STR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。