From 505196331f6e2b1632d2c01cf1846846fbf150d3 Mon Sep 17 00:00:00 2001 From: thomascecil <thomascecil@thomass-air.ern.nps.edu> Date: Tue, 2 May 2023 11:17:35 -0700 Subject: [PATCH] HW 2 commit. --- .../homework2/Cecil/MulticastUdpReceiverCecil.java | 8 ++++---- .../homework2/Cecil/MulticastUdpSenderCecil.java | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/assignments/src/MV3500Cohort2023MarchJune/homework2/Cecil/MulticastUdpReceiverCecil.java b/assignments/src/MV3500Cohort2023MarchJune/homework2/Cecil/MulticastUdpReceiverCecil.java index 6de9542685..8c8dd61733 100644 --- a/assignments/src/MV3500Cohort2023MarchJune/homework2/Cecil/MulticastUdpReceiverCecil.java +++ b/assignments/src/MV3500Cohort2023MarchJune/homework2/Cecil/MulticastUdpReceiverCecil.java @@ -29,7 +29,7 @@ public class MulticastUdpReceiverCecil /** * Time to live: how many router-decrement levels can be crossed */ - private static final int TTL = 10; + private static final int TTL = 4; private static final boolean INFINITE_READ_LOOP = true; private static NetworkInterface ni; @@ -66,7 +66,7 @@ public class MulticastUdpReceiverCecil // You can join multiple groups here System.out.println("Multicast address/port: " + multicastAddress.getHostAddress() + "/" + DESTINATION_PORT); - System.out.println("Multicast packets received log:"); + System.out.println("Come Mr Tally man, tally me bananas:"); int index, count = 0; // initialize float firstFloat, secondFloat; @@ -98,9 +98,9 @@ public class MulticastUdpReceiverCecil System.out.print(" "); // prettier output formatting } System.out.print(count + ". \"" + firstCharacters + "\" "); // wrap string in quote marks - System.out.println("index=" + index + ", firstFloat=" + firstFloat + " secondFloat=" + secondFloat); + System.out.println("index=" + index + ", firstFloat=" + firstFloat + " secondFloat=" + secondFloat + " bunch."); - System.out.println("MulticastReceiver loop complete."); + System.out.println("Daylight come and me want to go home."); firstCharacters.setLength(0); } } catch (IOException e) { diff --git a/assignments/src/MV3500Cohort2023MarchJune/homework2/Cecil/MulticastUdpSenderCecil.java b/assignments/src/MV3500Cohort2023MarchJune/homework2/Cecil/MulticastUdpSenderCecil.java index 37574e1038..b5ac6fa9e6 100644 --- a/assignments/src/MV3500Cohort2023MarchJune/homework2/Cecil/MulticastUdpSenderCecil.java +++ b/assignments/src/MV3500Cohort2023MarchJune/homework2/Cecil/MulticastUdpSenderCecil.java @@ -35,11 +35,11 @@ public class MulticastUdpSenderCecil public static final int TTL = 10; /** How many packets to send prior to termination */ - public static final int LOOPSIZE = 20; // or maybe 20000 + public static final int LOOPSIZE = 8; // or maybe 20000 /** Receiving this message causes termination * @see <a href="https://en.wikipedia.org/wiki/Sentinel_value">https://en.wikipedia.org/wiki/Sentinel_value</a> */ - public static final String QUIT_SENTINEL = "QUIT QUIT QUIT!"; + public static final String QUIT_SENTINEL = "Daylight come and me want to go home."; private static NetworkInterface ni; /** @@ -83,7 +83,7 @@ public class MulticastUdpSenderCecil byte[] buffer = baos.toByteArray(); DatagramPacket packet = new DatagramPacket(buffer, buffer.length, group/*, DESTINATION_PORT*/); - for (int index = 0; index < LOOPSIZE; index++) + for (int index = 5; index < LOOPSIZE; index++) { // Put together an updated packet to send if (index < LOOPSIZE - 1) @@ -100,7 +100,7 @@ public class MulticastUdpSenderCecil buffer = baos.toByteArray(); packet.setData(buffer); multicastSocket.send(packet); - System.out.println("Sent multicast packet " + (index + 1) + " of " + LOOPSIZE); + System.out.println((index + 1) + " foot"); baos.reset(); // How fast does this go? Does UDP try to slow it down, or does @@ -110,7 +110,7 @@ public class MulticastUdpSenderCecil // order packet, or dropped packet? Necessary considerations. Thread.sleep(1000); // Send 100, one per second } - System.out.println("MulticastSender complete."); + System.out.println("bunch."); } catch(IOException | InterruptedException e) { -- GitLab