JLChen
2021-12-07 bf547c154d899ec6d10efdff4b22cf732932f16b
HDLSDK/hdl-socket/src/main/java/com/hdl/sdk/socket/client/UdpClient.java
@@ -5,6 +5,7 @@
import com.hdl.sdk.common.HDLSdk;
import com.hdl.sdk.common.utils.IpUtils;
import com.hdl.sdk.common.utils.LogUtils;
import com.hdl.sdk.common.utils.ThreadToolUtils;
import com.hdl.sdk.socket.SocketBoot;
import com.hdl.sdk.socket.SocketOptions;
@@ -124,7 +125,7 @@
            return;
        }
        try {
            mSocket.receive(receivePacket);
           mSocket.receive(receivePacket);
        } catch (IOException e) {
            e.printStackTrace();
            isConnect.set(false);
@@ -144,11 +145,13 @@
        IHandleMessage handleMessage = getOptions().getHandleMessage();
        if (handleMessage != null) {
            handleMessage.read(receivePacket.getData());
            byte[] data = new byte[receivePacket.getLength()];
            System.arraycopy(receivePacket.getData(), 0, data, 0, data.length);
            handleMessage.read(data);
        }
        final String receive = new String(receivePacket.getData(), 0, receivePacket.getLength());
        Log.d("---->", receive + " from " + receivePacket.getAddress().getHostAddress() + ":" + receivePacket.getPort());
        LogUtils.d("---->", receive + " from " + receivePacket.getAddress().getHostAddress() + ":" + receivePacket.getPort());
        //重置长度
        if (receivePacket != null) {