I could set a maximum of 20 seconds as a timeout parameter in the select () API. No matter what value I gave above 20, select () returns after 20 seconds ... So I tried to write a loop for a timeout of 1 minute, like this
int timeoutcount = 0; do { FD_ZERO(&fd); FD_SET(sock,&fd); timeout.tv_sec = 20; timeout.tv_usec = 0; rc = select (sock+1,&fd,null,null,&timeout); if(rc ==0) timeoutcount += 20; } while(rc ==0 && timeoutcount <60)
please help me ... am i going right? If so, select returns 1 after the first timeout .. help me figure this out too Note: I use it in the C object
source share