Skip to content

Instantly share code, notes, and snippets.

@sunaemon
Created January 30, 2015 10:44
Show Gist options
  • Save sunaemon/4eb529a9ad311a5f0a25 to your computer and use it in GitHub Desktop.
Save sunaemon/4eb529a9ad311a5f0a25 to your computer and use it in GitHub Desktop.
#include <sys/select.h>
#include <fcntl.h>
#include <stdio.h>
int main()
{
int sock = open("/dev/urandom", O_RDONLY);
int r;
fd_set rfds;
FD_ZERO(&rfds);
FD_SET(sock, &rfds);
r = select(1, &rfds, NULL, NULL, NULL);
printf("end\n");
}
#include <sys/select.h>
#include <fcntl.h>
#include <stdio.h>
int main()
{
int sock = open("/dev/urandom", O_RDONLY);
int r;
fd_set rfds;
FD_ZERO(&rfds);
FD_SET(sock, &rfds);
r = select(sock+1, &rfds, NULL, NULL, NULL);
printf("end\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment