HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/socket/HDLAuthSocket.java
@@ -109,6 +109,8 @@ if (updBoot == null) { updBoot = UdpClient.init(ip, UDP_PORT, getUdpOptions()); updBoot.connect(); }else{ updBoot.getClient().getOptions().setIp(ip); } return updBoot; } HDLSDK/hdl-socket/src/main/java/com/hdl/sdk/socket/SocketBoot.java
@@ -34,6 +34,10 @@ private final IClient client; public IClient getClient() { return client; } /** * socket是否在运行 */ HDLSDK/hdl-socket/src/main/java/com/hdl/sdk/socket/SocketOptions.java
@@ -14,6 +14,9 @@ */ public class SocketOptions { //发送目标地址IP private String ip; //设置读取缓存 private int readMaxBufferSize = 512; @@ -45,6 +48,13 @@ private int soTimeout; private boolean soLinger; public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } public IHandleMessage getHandleMessage() { return handleMessage; HDLSDK/hdl-socket/src/main/java/com/hdl/sdk/socket/client/UdpClient.java
@@ -39,7 +39,7 @@ private final byte[] receiveByte; private final String ip; // private final String ip; private final int port; @@ -55,16 +55,10 @@ */ private UdpClient(String ip, int port, int monitorPort, int sendPort, SocketOptions socketOptions) { this.socketOptions = socketOptions; this.ip = ip; this.socketOptions.setIp(ip); this.port = port; this.sendPort = sendPort; this.monitorPort = monitorPort; this.receiveByte = new byte[BUFFER]; } public UdpClient(String ip, int port) { this.ip = ip; this.port = port; this.receiveByte = new byte[BUFFER]; } @@ -163,7 +157,8 @@ if (msg == null) { msg = new byte[1]; } InetAddress serverAddress = InetAddress.getByName(ip); InetAddress serverAddress = InetAddress.getByName(getOptions().getIp()); LogUtils.e("发送目标IP地址:"+getOptions().getIp()); final DatagramPacket sendPacket = new DatagramPacket(msg, msg.length, serverAddress, port); if (sendPort < 0) { final DatagramSocket sendSocket = new DatagramSocket();