From 0d79e777a7259e2fa26ac835c2fa3aaf7a214ee7 Mon Sep 17 00:00:00 2001 From: brutzman <brutzman@DESKTOP-2S09UKA> Date: Sun, 26 Jul 2020 15:17:26 -0700 Subject: [PATCH] better default name for diagnostics, easily modifiable --- examples/src/UdpMulticastHttpExamples/UdpSender.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/src/UdpMulticastHttpExamples/UdpSender.java b/examples/src/UdpMulticastHttpExamples/UdpSender.java index 18afda921b..83c0f6e6f1 100644 --- a/examples/src/UdpMulticastHttpExamples/UdpSender.java +++ b/examples/src/UdpMulticastHttpExamples/UdpSender.java @@ -16,8 +16,8 @@ import java.net.*; */ public class UdpSender { - - public static final int SENDING_PORT = 1414; + public static final String MY_NAME = "(default name)"; + public static final int SENDING_PORT = 1414; public static final int RECEIVING_PORT = 1415; public static final String DESTINATION_HOST = "localhost"; @@ -45,6 +45,8 @@ public class UdpSender // ID of the host we are sending to InetAddress destinationAddress = InetAddress.getByName(DESTINATION_HOST); + // ID of the host we are sending from + InetAddress sourceAddress = InetAddress.getByName("localhost"); // possibly identical if source not modified DatagramPacket packet = new DatagramPacket(buffer, buffer.length, destinationAddress, RECEIVING_PORT ); @@ -58,7 +60,7 @@ public class UdpSender { udpSocket.send(packet); Thread.sleep(1000); // Send 100, one per second - System.out.println("Bert Sent packet " + index + " of 100"); + System.out.println(MY_NAME + " " + sourceAddress + " sent packet " + index + " of 100"); } System.out.println("UdpSender complete."); } -- GitLab