winhttp(6/6): Implement connect timeout

Alexandre Julliard julliard at winehq.org
Wed Jul 22 07:50:04 CDT 2009


Juan Lang <juan.lang at gmail.com> writes:

> +BOOL netconn_connect( netconn_t *conn, const struct sockaddr *sockaddr, unsigned int addr_len, int timeout )
>  {
> -    if (connect( conn->socket, sockaddr, addr_len ) == -1)
> +    int flags = -1, res;
> +
> +    if (timeout > 0)
> +        flags = fcntl( conn->socket, F_GETFL, 0 );
> +    if (flags != -1)
> +        fcntl( conn->socket, F_SETFL, flags | O_NONBLOCK );
> +    res = connect( conn->socket, sockaddr, addr_len );
> +    if (res == -1 && (errno == EINPROGRESS || errno == EAGAIN))

This won't compile on Windows. You should use ioctlsocket and friends.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list