addd several ports option

This commit is contained in:
christian 2021-04-06 23:19:04 +02:00
parent 93c6d53f7a
commit dfc1729094

View File

@ -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) {