Skip to content
Snippets Groups Projects
Commit f3d8a331 authored by cs2017's avatar cs2017
Browse files

Angelopoulos/Blankenbeker Final Project

parent b7dd07e5
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ public class ABEspduReceiverA { ...@@ -19,7 +19,7 @@ public class ABEspduReceiverA {
* somewhat outdated--PDUs can be larger--but this is a reasonable starting point * somewhat outdated--PDUs can be larger--but this is a reasonable starting point
*/ */
public static final int MAX_PDU_SIZE = 8192; public static final int MAX_PDU_SIZE = 8192;
public static final String GROUP = "239.1.2.3";
public static void main(String args[]) { public static void main(String args[]) {
MulticastSocket socket; MulticastSocket socket;
DatagramPacket packet; DatagramPacket packet;
...@@ -28,11 +28,11 @@ public class ABEspduReceiverA { ...@@ -28,11 +28,11 @@ public class ABEspduReceiverA {
try { try {
// Specify the socket to receive data // Specify the socket to receive data
socket = new MulticastSocket(3001); socket = new MulticastSocket(3000);
socket.setBroadcast(true); socket.setBroadcast(true);
//address = InetAddress.getByName(EspduSender.DEFAULT_MULTICAST_GROUP); address = InetAddress.getByName(GROUP);
//socket.joinGroup(address); socket.joinGroup(address);
// Loop infinitely, receiving datagrams // Loop infinitely, receiving datagrams
while (true) { while (true) {
......
...@@ -4,7 +4,6 @@ import java.net.*; ...@@ -4,7 +4,6 @@ import java.net.*;
import java.util.*; import java.util.*;
import edu.nps.moves.disutil.*; import edu.nps.moves.disutil.*;
import edu.nps.moves.dis.*; import edu.nps.moves.dis.*;
/** /**
...@@ -19,6 +18,8 @@ public class ABEspduReceiverB { ...@@ -19,6 +18,8 @@ public class ABEspduReceiverB {
* somewhat outdated--PDUs can be larger--but this is a reasonable starting point * somewhat outdated--PDUs can be larger--but this is a reasonable starting point
*/ */
public static final int MAX_PDU_SIZE = 8192; public static final int MAX_PDU_SIZE = 8192;
public static final String GROUP = "239.1.2.3";
public static void main(String args[]) { public static void main(String args[]) {
MulticastSocket socket; MulticastSocket socket;
...@@ -28,11 +29,12 @@ public class ABEspduReceiverB { ...@@ -28,11 +29,12 @@ public class ABEspduReceiverB {
try { try {
// Specify the socket to receive data // Specify the socket to receive data
socket = new MulticastSocket(3001); socket = new MulticastSocket(3000);
socket.setBroadcast(true); socket.setBroadcast(true);
//address = InetAddress.getByName(EspduSender.DEFAULT_MULTICAST_GROUP);
//socket.joinGroup(address); address = InetAddress.getByName(GROUP);
socket.joinGroup(address);
// Loop infinitely, receiving datagrams // Loop infinitely, receiving datagrams
while (true) { while (true) {
......
...@@ -50,7 +50,7 @@ public static void main(String args[]) ...@@ -50,7 +50,7 @@ public static void main(String args[])
// Default settings. These are used if no system properties are set. // Default settings. These are used if no system properties are set.
// If system properties are passed in, these are over ridden. // If system properties are passed in, these are over ridden.
int port = DIS_DESTINATION_PORT; int port = DIS_DESTINATION_PORT;
NetworkMode mode = NetworkMode.BROADCAST; NetworkMode mode = NetworkMode.MULTICAST;
InetAddress destinationIp = null; InetAddress destinationIp = null;
try try
......
...@@ -20,7 +20,7 @@ public class ABEspduSenderB ...@@ -20,7 +20,7 @@ public class ABEspduSenderB
public enum NetworkMode{UNICAST, MULTICAST, BROADCAST}; public enum NetworkMode{UNICAST, MULTICAST, BROADCAST};
/** default multicast group we send on */ /** default multicast group we send on */
public static final String DEFAULT_MULTICAST_GROUP="239.1.2.3"; public static final String DEFAULT_MULTICAST_GROUP = "239.1.2.3";
/** Port we send on */ /** Port we send on */
public static final int DIS_DESTINATION_PORT = 3000; public static final int DIS_DESTINATION_PORT = 3000;
...@@ -50,7 +50,7 @@ public static void main(String args[]) ...@@ -50,7 +50,7 @@ public static void main(String args[])
// Default settings. These are used if no system properties are set. // Default settings. These are used if no system properties are set.
// If system properties are passed in, these are over ridden. // If system properties are passed in, these are over ridden.
int port = DIS_DESTINATION_PORT; int port = DIS_DESTINATION_PORT;
NetworkMode mode = NetworkMode.BROADCAST; NetworkMode mode = NetworkMode.MULTICAST;
InetAddress destinationIp = null; InetAddress destinationIp = null;
try try
......
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