in reply to Re^2: how to set socket recv timeout in architecture independent manner?
in thread how to set socket recv timeout in architecture independent manner?
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:
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.
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.
|
|---|