+ -
当前位置:首页 → 问答吧 → 求助:makefile错误 : commands commence before first target. Stop

求助:makefile错误 : commands commence before first target. Stop

时间:2010-08-06

来源:互联网

select系统调用会清空超时timeout或者根本不用while循环外的timeout?
为什么timeout放在while外面不起作用了呢?

代码:
while(1){
        testfds=readfds;
        timeout.tv_sec=2;
        timeout.tv_usec=500000;     //超时必须在while内

        printf("server waiting\n");
        result=select(FD_SETSIZE, &testfds, (fd_set *)NULL, (fd_set *)NULL, &timeout);
        switch(result){
            case 0:
                printf("timeout\n");
                break;

作者: sharp_minminzhu   发布时间: 2010-08-06

明白了,是会改写timeout的

作者: sharp_minminzhu   发布时间: 2010-08-06