Unnamed
public text v1 · immutable for( elapsed = ((double) (clock() - start)) / CLOCKS_PER_SEC; elapsed < 10.0; elapsed = ((double) (clock() - start)) / CLOCKS_PER_SEC )
{
FD_ZERO(&readset);
FD_SET(s, &readset);
if ( select(0, &readset, NULL, NULL, NULL) == 1) {
if (FD_ISSET(s, &readset)) {
recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr *)&from, &fromlen);
printf("%s is online\n", inet_ntoa(from.sin_addr));
}
} else {
printf("Error in select()'s return\n");
}
printf("%f secs past\n", elapsed);
}