Windows: RTU Server (Slave): modbus_receive() blocks / hang

60 views
Skip to first unread message

ottelo

unread,
Nov 18, 2021, 2:57:39 AM11/18/21
to libmodbus
Hi there!
I compiled the project with Visual Studio 2008 in Win10. I put the dll and lib and all header files in my new C project and put the code from unit-test-server into my main. I want to use RTU Slave (Server) and my port 1:

ctx = modbus_new_rtu("\\\\.\\COM1", 115200, 'N', 8, 1);

works!

rc = modbus_connect(ctx);

works!

rc = modbus_receive(ctx, query);

Blocks ... inside the function :(

I use #include <winsock2.h> together with WSock32.lib.
Message has been deleted

ottelo

unread,
Nov 18, 2021, 6:54:37 AM11/18/21
to libmodbus
It only continues if I really send commands from an RTU Master (Client).
Reply all
Reply to author
Forward
0 new messages