- 论坛徽章:
- 0
|
先建立了20个SOCKET,并放入了select监听队列 wset 然后运行SELECT命令,发生Operation now in progress错误,不知道怎么回事,急!!在线等
- struct timeval tv;//SELECT超时时间
-
- int i;
- while(count)
- {
- tv.tv_sec = 10;
- tv.tv_usec=0;
- printf("1111\n");
- fflush(stdout);
- if(select(1024+1,NULL,&wset,NULL,&tv)<=0)
- {
- printf("%d,%s\n",errno,strerror(errno));
- continue;
- }
- printf("2222\n");
- fflush(stdout);
- for(i=4;i<1024+1;i++)
- {
- printf("-%d-",i);
- fflush(stdout);
- if(strlen(fdcache[i])>0)
- {
- printf("3333\n");
- fflush(stdout);
- if(FD_ISSET(i,&wset))
- {
- memset(fdcache[i],0,1024);
- FD_CLR(i,&wset);
- //FD_CLR(i,&rset);
- printf("%d\n",i);
- fflush(stdout);
- count--;
- close(i);
- sleep(1);
- }
- printf("count:%d\n",count);
- }
-
- }
-
- }
复制代码 |
|