RESEND: Handle shortened *optval arg. in WS_setsockopt / WS_SO_RCVTIMEO

Rein Klazes rklazes at xs4all.nl
Wed Sep 25 03:37:35 CDT 2002


On Tue, 24 Sep 2002 16:10:43 -0500, you wrote:


> +	    if (level == SOL_SOCKET && optname == SO_RCVTIMEO && optlen < sizeof(struct timeval)) {
> +	        if (optlen == sizeof(time_t)) {
> +	            /* Apparently WinSock will accept a shortened struct timeval.

In Unix the arg optval points to a struct timeval, in windows to a
(32bit) int, no mystery here. The latter is the timeout in
milliseconds. Further a non-zero timeout less then 500 (msec) is taken
as 500 msec. 

> +		       FIXME: should we do the same for SO_SNDTIMEO? */

Of course, its the same issue.

> +	            WARN("Short struct timeval in SO_RCVTIMEO: assuming time_t\n");
> +		    tval.tv_sec = *(time_t*)optval;
> +		    tval.tv_usec = 0;

You will need to convert from milliseconds here.


Unfortunately this does not work (a recv timing out). The socket in
wine is non-blocking internally, any blocking will be done in the
function do_block() using a select(). SO_RCVTMO has no effect there.

Rein.
-- 
Rein Klazes
rklazes at xs4all.nl



More information about the wine-devel mailing list