stephane / libmodbus

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

[bug] Modbus tcp server exit when a client disconnects #701

Open RD2G opened 1 year ago

RD2G commented 1 year ago

libmodbus version

v3.1.8

OS and/or distribution

Windows

Environment

Intel CPU, 64Bit

Description

I encountered a problem when testing the modbus server. The server exits when the client disconnects. I used the demo from https://github.com/stephane/libmodbus/blob/master/tests/bandwidth-server-many-up.c. The server hangs on line 128 (close(master_socket);).

Actual behavior if applicable

I encountered a problem when testing the modbus server. The server exits when the client disconnects. I used the demo from https://github.com/stephane/libmodbus/blob/master/tests/bandwidth-server-many-up.c. The server hangs on line 128 (close(master_socket);).

Expected behavior or suggestion

The server should not exit.

Steps to reproduce the behavior (commands or source code)

libmodbus output with debug mode enabled