JLChen
2021-12-10 04122050f9b2bf5612d26f8394cc2ead03b57258
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();