【同步】BOOT 和 CLOUD 的功能(IoT)
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled

This commit is contained in:
YunaiV
2026-02-14 16:52:20 +08:00
parent 6ca2c97849
commit 1fca0acc92

View File

@@ -6,6 +6,8 @@ import com.ghgande.j2mod.modbus.procimg.*;
import com.ghgande.j2mod.modbus.slave.ModbusSlave;
import com.ghgande.j2mod.modbus.slave.ModbusSlaveFactory;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
@@ -156,8 +158,8 @@ public class ModbusRtuOverTcpDemo {
private static void bridge(Socket src, Socket dst) {
try {
byte[] buf = new byte[1024];
var in = src.getInputStream();
var out = dst.getOutputStream();
InputStream in = src.getInputStream();
OutputStream out = dst.getOutputStream();
int len;
while ((len = in.read(buf)) != -1) {
out.write(buf, 0, len);