当前位置: 技术问答>linux和unix
linux平台下. socket接收的问题
来源: 互联网 发布时间:2016-12-13
本文导语: bool RecvData( char* pBuf, int& nLen,int iTimeOut=50 ); 函数原形 bool CTcpSocket::RecvData( char* pBuf, int& nLen,int iTimeOut ) { bool bIsOK = true; m_tmout.tv_sec = iTimeOut; m_tmout.tv_usec = 0; FD_ZERO( &m_fdset ); FD_SET( m_...
bool RecvData( char* pBuf, int& nLen,int iTimeOut=50 ); 函数原形
bool CTcpSocket::RecvData( char* pBuf, int& nLen,int iTimeOut )
{
bool bIsOK = true;
m_tmout.tv_sec = iTimeOut;
m_tmout.tv_usec = 0;
FD_ZERO( &m_fdset );
FD_SET( m_Socket, &m_fdset);
int rel = select( m_Socket + 1, &m_fdset, NULL,NULL, &m_tmout);
int nTotal = 0;
int nEachLen = 0;
while( nTotal
bool CTcpSocket::RecvData( char* pBuf, int& nLen,int iTimeOut )
{
bool bIsOK = true;
m_tmout.tv_sec = iTimeOut;
m_tmout.tv_usec = 0;
FD_ZERO( &m_fdset );
FD_SET( m_Socket, &m_fdset);
int rel = select( m_Socket + 1, &m_fdset, NULL,NULL, &m_tmout);
int nTotal = 0;
int nEachLen = 0;
while( nTotal