Fix bug where length of UDP packet was incorrect

This commit is contained in:
Tobias Eidelpes 2020-11-18 10:29:37 +01:00
parent a9434493a1
commit cc5f04d668

View File

@ -268,7 +268,7 @@ public class TransferServer implements ITransferServer, Runnable {
} }
byte[] sendBuffer = (transferHost + ":" + transferPort + " " + msg.getFrom().toString()).getBytes(); byte[] sendBuffer = (transferHost + ":" + transferPort + " " + msg.getFrom().toString()).getBytes();
try { try {
DatagramPacket packet = new DatagramPacket(sendBuffer, 1024, Inet4Address.getByName(monitoringHost), monitoringPort); DatagramPacket packet = new DatagramPacket(sendBuffer, sendBuffer.length, Inet4Address.getByName(monitoringHost), monitoringPort);
socket.send(packet); socket.send(packet);
} catch (IOException e) { } catch (IOException e) {
logger.severe("Failed to send packet to " + monitoringHost + " on port " + monitoringPort); logger.severe("Failed to send packet to " + monitoringHost + " on port " + monitoringPort);