Re: winhttp(6/6): Implement connect timeout
22 Jul
2009
22 Jul
'09
12:50 p.m.
Juan Lang <juan.lang(a)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(a)winehq.org
6077
Age (days ago)
6077
Last active (days ago)
0 comments
1 participants
participants (1)
-
Alexandre Julliard