1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00

Fix nonblocking connect on Windows

Use the correct value for the call to ioctlsocket() to set the socket to
nonblocking mode and check for WSAWOULDBLOCK return value of connect().
This commit is contained in:
Patrick Gansterer 2014-03-27 11:21:41 +01:00 committed by Andy Green
parent 7844d04adc
commit a616300091
2 changed files with 3 additions and 2 deletions

View file

@ -177,7 +177,8 @@ struct libwebsocket *libwebsocket_client_connect_2(
if (connect(wsi->sock, v, n) == -1 || LWS_ERRNO == LWS_EISCONN) {
if (LWS_ERRNO == LWS_EALREADY || LWS_ERRNO == LWS_EINPROGRESS) {
if (LWS_ERRNO == LWS_EALREADY || LWS_ERRNO == LWS_EINPROGRESS
|| LWS_ERRNO == LWS_EWOULDBLOCK) {
lwsl_client("nonblocking connect retry\n");
/*

View file

@ -694,7 +694,7 @@ int lws_set_socket_options(struct libwebsocket_context *context, int fd)
int optval = 1;
socklen_t optlen = sizeof(optval);
#if defined(WIN32) || defined(_WIN32)
unsigned long optl = 0;
u_long optl = 1;
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
struct protoent *tcp_proto;