The SO_RCVTIMEO option that you've set on the socket is effectively an inactivity timer. In other words, by setting RCVTIMEO you're ensuring that the recvfrom call will return after the timer expires even if no data has been received. It doesn't sound like that's exactly what you're trying to do.
There are several ways to do what you're asking... here are a couple of ideas.
If you are comfortable with signals, you could use 'setitimer' to track your maximum timeout.
http://linux.die.net/man/2/setitimer
It would send your process a SIGALRM upon timer expiry, and in your signal handler you could set a flag that tells your recvfrom loop to exit.
You could alternatively grab the system time at your starting point and then poll it in your recvfrom loop to see if you've passed the desired timeout value.
http://dell5.ma.utexas.edu/cgi-bin/man-cgi?gettimeofday+2