可以用Select进行保护
fd_set fds;
int nError;
struct timeval timeout;
timeout.tv_sec = iWaitTime;     //   second timeout
timeout.tv_usec = 0;
FD_ZERO(&fds);
FD_SET( m_hSocket, &fds ); //向集合fds添加hSocket
nError = select( m_hSocket + 1, &fds, NULL, NULL, &timeout );
if( nError <=0 )
{
sprintf(szError,"网络错误");
return -1;
}

解决方案 »

  1.   

    http://www.csdn.net/expert/topic/411/411075.shtm
    分数为150分
    十万火级,如能给出答案,再送300分
    有兴趣的人留下email
    我把程序发给你们。 
    一个很cool的表格程序,请问如何改为activeX控件,有兴趣的我把源代码发给你们,感兴趣的人留下email,
    是vc写的非常cool
      

  2.   

    来一份,看看,我帮你改 [email protected]
                       [email protected]                   [email protected]
                       [email protected]
      

  3.   

    用tcp接收,似乎就有这种问题。关住中