diff --git a/src/modbus-tcp.c b/src/modbus-tcp.c index 2b737c4..75b9665 100644 --- a/src/modbus-tcp.c +++ b/src/modbus-tcp.c @@ -328,6 +328,12 @@ static int _modbus_tcp_pi_connect(modbus_t *ctx) struct addrinfo ai_hints; modbus_tcp_pi_t *ctx_tcp_pi = ctx->backend_data; +#ifdef OS_WIN32 + if (_modbus_tcp_init_win32() == -1) { + return -1; + } +#endif + memset(&ai_hints, 0, sizeof(ai_hints)); #ifdef AI_ADDRCONFIG ai_hints.ai_flags |= AI_ADDRCONFIG;