标题: 一个select问题 [打印本页] 作者: zlh2407 时间: 2006-07-18 15:43 标题: 一个select问题 我做了个小程序,这个程序在while(1)中,总是执行第二次select 时,就跳出,不知为何?请帮我分析一下,处处信息为:accept from outer
select is made !
close s6
s41 timeoff!
accept from outer
select is made !
close s6
select error
代码为:
fd_set connect_sock_set,wfd_set,efd_set,rfd_set;
struct timeval connect_sock_tv,connect_sock_tv1;
alen=sizeof(server);
if((s2=accept(s32,(struct sockaddr*)&server,&alen))<0){
printf("MIDDLE accept from middle to reboot failed\n,%s\n",strerror(errno));
close(s2);
close(s32);
exit(-1);
}
printf("accept in halt() info from middle and prepare to reboot \n");
if(i<0){
printf("select error !\n");
exit(-1);
}作者: zlh2407 时间: 2006-07-18 15:46 标题: 不好意思,出错信息为 socket s3 in outer check()is over
initation in check() is over
connect to inner in check() is right!
send in check is over
close s3
s32 timeoff!
socket s3 in outer check()is over
initation in check() is over
connect to inner in check() is right!
send in check is over
close s3
select s32 time is over !
select error !作者: zlh2407 时间: 2006-07-18 15:54 标题: 这只是程序一部分,所以这部分错误信息为 s32 timeoff!
select s32 time is over !
select error !
其中“s32 timeoff!”为第一次执行式的出错信息,然后继续“select s32 time is over !
select error !
”为执行第二次循环时的出错信息,然后跳出程序作者: zlh2407 时间: 2006-07-18 15:59
整个问题也就是一句话:代码希望在30秒内到达时自动执行下一段程序,从这段程序中跳出,然而结果是:第一次执行正常,等执行第二次循环时,跳出程序,这不是程序所希望的,问题还没找出来作者: zlh2407 时间: 2006-07-18 17:34
??作者: zlh2407 时间: 2006-07-19 09:59
不知为何?