Well okay, I'm glad you got what works for you, but ... in your orignal post you asked for how to
set recv timeout ... architecture independent way
That generally means there are two problems to solve:
- Are the system functions available to do X.
And ignoring obscure little used platforms, that usually divides into POSIX and Win platforms. As setsockopt is a POSIX core function that takes care of most places. My post was to show you that it is available on windows also.
- Passing architecture-dependant binary values.
By using a '!L', you get an architecture independant way of native longs.
Whilst using select and can_read() with timeout achieves a similar goal, you are substituting a 'polling' solution for a timer solution (at least in some platforms), and that can significantly increase you cpu usage.
In addition, using select imposes a particular architecture--which is often unnatural--upon your application. If your happy with that, then great, but I thought the alternative worth a mention.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |