Commit be4b215d9e56a9264b818d6742cc93164963ff46
1 parent
23dd803f
Fix TCP PI init under Windows
Thanks to oldfaber
Showing
1 changed file
with
6 additions
and
0 deletions
src/modbus-tcp.c
| @@ -328,6 +328,12 @@ static int _modbus_tcp_pi_connect(modbus_t *ctx) | @@ -328,6 +328,12 @@ static int _modbus_tcp_pi_connect(modbus_t *ctx) | ||
| 328 | struct addrinfo ai_hints; | 328 | struct addrinfo ai_hints; |
| 329 | modbus_tcp_pi_t *ctx_tcp_pi = ctx->backend_data; | 329 | modbus_tcp_pi_t *ctx_tcp_pi = ctx->backend_data; |
| 330 | 330 | ||
| 331 | +#ifdef OS_WIN32 | ||
| 332 | + if (_modbus_tcp_init_win32() == -1) { | ||
| 333 | + return -1; | ||
| 334 | + } | ||
| 335 | +#endif | ||
| 336 | + | ||
| 331 | memset(&ai_hints, 0, sizeof(ai_hints)); | 337 | memset(&ai_hints, 0, sizeof(ai_hints)); |
| 332 | #ifdef AI_ADDRCONFIG | 338 | #ifdef AI_ADDRCONFIG |
| 333 | ai_hints.ai_flags |= AI_ADDRCONFIG; | 339 | ai_hints.ai_flags |= AI_ADDRCONFIG; |