
Untitled
By: a guest on
Jul 15th, 2012 | syntax:
C | size: 0.32 KB | hits: 26 | expires: Never
timeout.tv_sec = 3;
timeout.tv_usec = 0;
FD_ZERO(&fds);
FD_SET(sock_fd, &fds);
while(running) {
printf("Waiting for connect");
if((result = select(32, &fds, NULL, NULL, &timeout)) == -1) {
printf("select returned an error");
return -1;
}
if(result == 0) {
printf("no connections");
}
}