| | |
| | |
|
| | | private final byte[] receiveByte;
|
| | |
|
| | | private final String ip;
|
| | | // private final String ip;
|
| | |
|
| | | private final int port;
|
| | |
|
| | |
| | | */
|
| | | 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];
|
| | | }
|
| | |
|
| | |
| | | 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();
|