(E-Mail Removed) schrieb:
> I think the following is possibly a correct solution
[...]
> alarm(5);// will timeout in 5 seconds
> recvfrom(...);
> alarm(0);// turn off the alarm
No, it isn't. It also has a race condition: After a successful read but
before the alarm(0) the SIGALRM can occour resulting in you thinking
there's a timeout when there isn't.
You really ought to go with poll(2) instead of that error-prone,
difficult-to-decipher setjmp stuff.
Regards,
Johannes
--
"Meine Gegenklage gegen dich lautet dann auf bewusste Verlogenheit,
verlästerung von Gott, Bibel und mir und bewusster Blasphemie."
-- Prophet und Visionär Hans Joss aka HJP in de.sci.physik
<48d8bf1d$0$7510$(E-Mail Removed)>