Skip to content
Snippets Groups Projects
Commit dfa87210 authored by brutzman's avatar brutzman
Browse files

class, import names

parent 4ce58499
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,7 @@ public class UDPReceiverGaribay ...@@ -27,7 +27,7 @@ public class UDPReceiverGaribay
try try
{ {
System.out.println(UdpReceiver.class.getName() + " started..."); System.out.println(UDPReceiverGaribay.class.getName() + " started...");
// Create a UDP socket // Create a UDP socket
udpSocket = new DatagramSocket(RECEIVING_PORT); udpSocket = new DatagramSocket(RECEIVING_PORT);
...@@ -65,7 +65,7 @@ public class UDPReceiverGaribay ...@@ -65,7 +65,7 @@ public class UDPReceiverGaribay
padding = " "; padding = " ";
else padding = ""; else padding = "";
System.out.println("[" + UdpReceiver.class.getName() + "]" + System.out.println("[" + UDPReceiverGaribay.class.getName() + "]" +
" packetID=" + firstInt + // have output message use same name as sender " packetID=" + firstInt + // have output message use same name as sender
", second float value=" + secondFloat + ", second float value=" + secondFloat +
", third String value=\"" + thirdString + "\"" + // note that /" is literal quote character ", third String value=\"" + thirdString + "\"" + // note that /" is literal quote character
...@@ -82,7 +82,7 @@ public class UDPReceiverGaribay ...@@ -82,7 +82,7 @@ public class UDPReceiverGaribay
{ {
if (udpSocket != null) if (udpSocket != null)
udpSocket.close(); udpSocket.close();
System.out.println(UdpReceiver.class.getName() + " complete."); // all done System.out.println(UDPReceiverGaribay.class.getName() + " complete."); // all done
} }
} }
} }
package MV3500Cohort2020JulySeptember.homework3.Garibay; package MV3500Cohort2020JulySeptember.homework3.Garibay;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.DatagramPacket; import java.net.DatagramPacket;
...@@ -38,8 +36,8 @@ public class UDPSenderGaribay ...@@ -38,8 +36,8 @@ public class UDPSenderGaribay
try try
{ {
System.out.println(UdpSender.class.getName() + " shows how to send simple-type values via DataOutputStream"); System.out.println(UDPSenderGaribay.class.getName() + " shows how to send simple-type values via DataOutputStream");
System.out.println(UdpSender.class.getName() + " started..."); System.out.println(UDPSenderGaribay.class.getName() + " started...");
// Create a UDP socket // Create a UDP socket
udpSocket = new DatagramSocket(); // let system assign output port, then SENDING_PORT not needed udpSocket = new DatagramSocket(); // let system assign output port, then SENDING_PORT not needed
...@@ -90,7 +88,7 @@ public class UDPSenderGaribay ...@@ -90,7 +88,7 @@ public class UDPSenderGaribay
else padding = ""; else padding = "";
Thread.sleep(1000); // Send packets at rate of one per second Thread.sleep(1000); // Send packets at rate of one per second
System.out.println("[" + UdpSender.class.getName() + "] " + MY_NAME + " " + sourceAddress + System.out.println("[" + UDPSenderGaribay.class.getName() + "] " + MY_NAME + " " + sourceAddress +
" sent values(" + packetID + "," + value + ",\"" + message + "\"," + isPacketIdEvenParity + " sent values(" + packetID + "," + value + ",\"" + message + "\"," + isPacketIdEvenParity +
")" + padding + " as packet #" + index + " of " + TOTAL_PACKETS_TO_SEND); ")" + padding + " as packet #" + index + " of " + TOTAL_PACKETS_TO_SEND);
baos.reset(); // clear the output stream after sending baos.reset(); // clear the output stream after sending
...@@ -98,7 +96,7 @@ public class UDPSenderGaribay ...@@ -98,7 +96,7 @@ public class UDPSenderGaribay
} }
catch (IOException | InterruptedException e) catch (IOException | InterruptedException e)
{ {
System.err.println("Problem with UdpSender, see exception trace:"); System.err.println("Problem with UDPSenderGaribay, see exception trace:");
System.err.println(e); System.err.println(e);
} }
finally // clean up prior to exit, don't want to leave behind zombies finally // clean up prior to exit, don't want to leave behind zombies
...@@ -108,7 +106,7 @@ public class UDPSenderGaribay ...@@ -108,7 +106,7 @@ public class UDPSenderGaribay
if (dos != null) if (dos != null)
dos.close(); dos.close();
System.out.println(UdpSender.class.getName() + " complete."); // all done System.out.println(UDPSenderGaribay.class.getName() + " complete."); // all done
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment