From 34ec939a7538c6fe4d8479a613c7e886491aa352 Mon Sep 17 00:00:00 2001 From: Stéphane Raimbault Date: Tue, 22 Jan 2013 23:55:41 +0100 Subject: [PATCH] Another quick workaround for deficient OS (closes #63) --- src/modbus-tcp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modbus-tcp.c b/src/modbus-tcp.c index e7b12cc..e50cfc8 100644 --- a/src/modbus-tcp.c +++ b/src/modbus-tcp.c @@ -1,5 +1,5 @@ /* - * Copyright © 2001-2011 Stéphane Raimbault + * Copyright © 2001-2013 Stéphane Raimbault * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -255,7 +255,12 @@ static int _connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen, int rc; rc = connect(sockfd, addr, addrlen); + +#ifdef OS_WIN32 + if (rc == -1 && WSAGetLastError() == WSAEINPROGRESS) { +#else if (rc == -1 && errno == EINPROGRESS) { +#endif fd_set wset; int optval; socklen_t optlen = sizeof(optval); -- libgit2 0.21.4