fcntl( fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK );
fd_set wfds;
           struct timeval tv;
           int retval;           /* Watch stdin (fd 0) to see when it has input. */
           FD_ZERO(&wfds);
         for(;;) {
           
           FD_SET(fd, &wfds);
           
           /* Wait up to five seconds. */
           tv.tv_sec = 1;
           tv.tv_usec = 0;           retval = select(1+fd, NULL, &wfds, NULL, &tv);
           /* Don't rely on the value of tv now! */           if (retval == -1)
               perror("select()");
           else if (retval && FD_ISSET(fd, &wfds)) {
               //printf("Data is available now.\n");
               
               memset(buffer, 0x00, 1024);
write(fd, buffer, 1024,0);
s+=1024;
printf("Data Send total %d\n", s);

if(s>=l) {
FD_CLR(fd, &wfds);
break;
cout << "over" << endl;
}
           } else {
               //printf("No data within five seconds.\n");
           }
         }
一直以来没有搞明白select检测数据可写是怎么回事,今天写测试程序
判断fd是否可写,可写就发送数据结果一会select就返回0并且一直这样了
netstat -an察看发现队列数据一直没有变化
请高手解答