addd several ports option
This commit is contained in:
parent
93c6d53f7a
commit
dfc1729094
@ -769,7 +769,11 @@ public class Datahandler {
|
||||
|
||||
public void update_autismo_socket_msg() {
|
||||
try {
|
||||
try (DatagramSocket serverSocket = new DatagramSocket(48477)) {
|
||||
List<Integer> portlists = new ArrayList<>();
|
||||
portlists.add(48477);
|
||||
portlists.add(48478);
|
||||
for (Integer port : portlists)
|
||||
try (DatagramSocket serverSocket = new DatagramSocket(port)) {
|
||||
byte[] receiveData = new byte[4096];
|
||||
InetAddress IPAddress = InetAddress.getByName("144.76.218.19");
|
||||
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
|
||||
@ -779,7 +783,7 @@ public class Datahandler {
|
||||
sentence = sentence.replace("clientmessage:", "");
|
||||
String getResponseMsg = getResponseMsg(sentence);
|
||||
byte[] sendData = getResponseMsg.getBytes("UTF-8");
|
||||
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, 48477);
|
||||
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port);
|
||||
serverSocket.send(sendPacket);
|
||||
}
|
||||
} catch (CustomError ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user