stephane / libmodbus

A Modbus library for Linux, Mac OS, FreeBSD and Windows
http://libmodbus.org
GNU Lesser General Public License v2.1
3.33k stars 1.71k forks source link

Error using modbus_tcp_pi #60

Closed oldfaber closed 12 years ago

oldfaber commented 12 years ago

_modbus_tcp_pi_connect() fails under Windows with error 10093 WSANOTINITIALISED. It should call to _modbus_tcp_init_win32() like _modbus_tcp_connect(). This patch fixes this. I checked github and I think this is still an error in master.

Regards Fabio

--- libmodbus-3.0.2/src/modbus-tcp.c 2012-01-25 05:29:36.000000000 +0100 +++ libmodbus-3.0.2-new/src/modbus-tcp.c 2012-05-18 14:08:46.767905000 +0200 @@ -288,6 +288,12 @@ static int _modbus_tcp_pi_connect(modbus struct addrinfo ai_hints; modbus_tcp_pi_t *ctx_tcp_pi = ctx->backend_data;

+#ifdef OS_WIN32

stephane commented 12 years ago

Good catch! Merged on master and stable. Thank you.