Commit 34ec939a7538c6fe4d8479a613c7e886491aa352
1 parent
c9960a0f
Another quick workaround for deficient OS (closes #63)
It will better to code something such as: https://github.com/crossroads-io/libxs/blob/master/src/err.cpp I don't intend to rewrite glib neither :(
Showing
1 changed file
with
6 additions
and
1 deletions
src/modbus-tcp.c
| 1 | 1 | /* |
| 2 | - * Copyright © 2001-2011 Stéphane Raimbault <stephane.raimbault@gmail.com> | |
| 2 | + * Copyright © 2001-2013 Stéphane Raimbault <stephane.raimbault@gmail.com> | |
| 3 | 3 | * |
| 4 | 4 | * This library is free software; you can redistribute it and/or |
| 5 | 5 | * 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, |
| 255 | 255 | int rc; |
| 256 | 256 | |
| 257 | 257 | rc = connect(sockfd, addr, addrlen); |
| 258 | + | |
| 259 | +#ifdef OS_WIN32 | |
| 260 | + if (rc == -1 && WSAGetLastError() == WSAEINPROGRESS) { | |
| 261 | +#else | |
| 258 | 262 | if (rc == -1 && errno == EINPROGRESS) { |
| 263 | +#endif | |
| 259 | 264 | fd_set wset; |
| 260 | 265 | int optval; |
| 261 | 266 | socklen_t optlen = sizeof(optval); | ... | ... |