I am doing something like this
val = select(max_fd+1,&readfd,0,0,0);
if(val >=1){
printf("I have got some value");
}
My code breaks out of select for no reason. It receives no packet. On 10 runs , I get 1 run where it waits on select. Rest it just quits.
Socket has been set up to receive ICMP packets. On that 1 run, it works perfectly. Why is this crapping out 9 times?
My guess is that your file descriptor is closed during the process. In this case
valwill be -1 anderrnowil be set toEBADF.