MangoAutomation / modbus4j

A high-performance and ease-of-use implementation of the Modbus protocol written in Java. Supports ASCII, RTU, TCP, and UDP transports as slave or master, automatic request partitioning and response data type parsing.
GNU General Public License v3.0
881 stars 370 forks source link

fix connection error when open stream #62

Open youxingz opened 1 year ago

youxingz commented 1 year ago

When open a new connection, it will throw a NullPointerException if the serial wire does not connect. After connection open, if the slave device is not exist, the stream should be closed and stop reading bits from device, fixed in file src/com/serotonin/modbus4j/sero/messaging/InputStreamListener.java at line 108. :)