ioctl(fd,FIONREAD,&nread) nread == 0

for  (fd  =   0 ;fd  <  FD_SETSIZE;fd ++ )
{
        
if (FD_ISSET(fd,&testSet))
        
{
            
int nread;
            ioctl(fd,FIONREAD,
&nread);
            
if (nread == 0)
            
{
                printf(
"connect close ");   //对方已经断开连接
            }

            
else
            
{
                
int recvBuffSize = strlen(recvBuff);
                read(fd,recvBuff,recvBuffSize);  
                        }

                }

}
 

你可能感兴趣的:(ioctl(fd,FIONREAD,&nread) nread == 0)