Skip to content
Snippets Groups Projects
Commit e3555b70 authored by Brutzman, Don's avatar Brutzman, Don
Browse files

Merge origin/master

parents be111413 9c928f4d
No related branches found
No related tags found
No related merge requests found
...@@ -37,13 +37,13 @@ public class ABEspduReceiverB { ...@@ -37,13 +37,13 @@ public class ABEspduReceiverB {
// Specify the socket to receive data // Specify the socket to receive data
socket = new MulticastSocket(3101); socket = new MulticastSocket(3101);
socket.setBroadcast(true); socket.setBroadcast(true);
int connectionCount = 0; //int connectionCount = 0;
ServerSocket serverSocket = new ServerSocket(2999); // ServerSocket serverSocket = new ServerSocket(2999);
Socket clientConnection = serverSocket.accept(); //Socket clientConnection = serverSocket.accept();
InputStream is = clientConnection.getInputStream(); //InputStream is = clientConnection.getInputStream();
InputStreamReader isr = new InputStreamReader(is); //InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr); //BufferedReader br = new BufferedReader(isr);
address = InetAddress.getByName(GROUP); address = InetAddress.getByName(GROUP);
socket.joinGroup(address); socket.joinGroup(address);
...@@ -62,18 +62,18 @@ public class ABEspduReceiverB { ...@@ -62,18 +62,18 @@ public class ABEspduReceiverB {
String serverMessage = br.readLine(); //String serverMessage = br.readLine();
System.out.println("The message the client sent was " + serverMessage); //System.out.println("The message the client sent was " + serverMessage);
// Print some information locally about the Socket // Print some information locally about the Socket
// connection. This includes the port and IP numbers // connection. This includes the port and IP numbers
// on both sides (the socket pair.) // on both sides (the socket pair.)
InetAddress localAddress = clientConnection.getLocalAddress(); // InetAddress localAddress = clientConnection.getLocalAddress();
InetAddress remoteAddress = clientConnection.getInetAddress(); //InetAddress remoteAddress = clientConnection.getInetAddress();
int localPort = clientConnection.getLocalPort(); //int localPort = clientConnection.getLocalPort();
int remotePort = clientConnection.getPort(); //int remotePort = clientConnection.getPort();
// My socket pair connection looks like this, to localhost: // My socket pair connection looks like this, to localhost:
// Socket pair: (( /0:0:0:0:0:0:0:1, 2317 ), ( /0:0:0:0:0:0:0:1, 54876 )) // Socket pair: (( /0:0:0:0:0:0:0:1, 2317 ), ( /0:0:0:0:0:0:0:1, 54876 ))
...@@ -83,10 +83,10 @@ public class ABEspduReceiverB { ...@@ -83,10 +83,10 @@ public class ABEspduReceiverB {
// different ports? // different ports?
System.out.println("Socket pair: (( " + localAddress.toString() + ", " + localPort + " ), ( " + //System.out.println("Socket pair: (( " + localAddress.toString() + ", " + localPort + " ), ( " +
remoteAddress.toString() + ", " + remotePort + " ))"); // remoteAddress.toString() + ", " + remotePort + " ))");
System.out.println("Connection count is: " + connectionCount); //System.out.println("Connection count is: " + connectionCount);
List<Pdu> pduBundle = pduFactory.getPdusFromBundle(packet.getData()); List<Pdu> pduBundle = pduFactory.getPdusFromBundle(packet.getData());
System.out.println("Bundle size is " + pduBundle.size()); System.out.println("Bundle size is " + pduBundle.size());
......
...@@ -56,6 +56,7 @@ public static void main(String args[]) ...@@ -56,6 +56,7 @@ public static void main(String args[])
try try
{ {
destinationIp = InetAddress.getByName(DEFAULT_MULTICAST_GROUP); destinationIp = InetAddress.getByName(DEFAULT_MULTICAST_GROUP);
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -151,6 +152,13 @@ public static void main(String args[]) ...@@ -151,6 +152,13 @@ public static void main(String args[])
// Loop through sending N ESPDUs // Loop through sending N ESPDUs
try try
{ {
int connectionCount = 0;
ServerSocket serverSocket = new ServerSocket(2999);
Socket clientConnection = serverSocket.accept();
InputStream is = clientConnection.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
System.out.println("Sending " + NUMBER_TO_SEND + " ESPDU packets to " + destinationIp.toString()); System.out.println("Sending " + NUMBER_TO_SEND + " ESPDU packets to " + destinationIp.toString());
for(int idx = 0; idx < NUMBER_TO_SEND; idx++) for(int idx = 0; idx < NUMBER_TO_SEND; idx++)
{ {
...@@ -232,6 +240,32 @@ public static void main(String args[]) ...@@ -232,6 +240,32 @@ public static void main(String args[])
FirePdu fire = new FirePdu(); FirePdu fire = new FirePdu();
byte[] fireArray = fire.marshal(); byte[] fireArray = fire.marshal();
String serverMessage = br.readLine();
System.out.println("The message the client sent was " + serverMessage);
// Print some information locally about the Socket
// connection. This includes the port and IP numbers
// on both sides (the socket pair.)
InetAddress localAddress = clientConnection.getLocalAddress();
InetAddress remoteAddress = clientConnection.getInetAddress();
int localPort = clientConnection.getLocalPort();
int remotePort = clientConnection.getPort();
// My socket pair connection looks like this, to localhost:
// Socket pair: (( /0:0:0:0:0:0:0:1, 2317 ), ( /0:0:0:0:0:0:0:1, 54876 ))
// Socket pair: (( /0:0:0:0:0:0:0:1, 2317 ), ( /0:0:0:0:0:0:0:1, 54881 ))
//
// Why is the first IP/port the same, while the second set has
// different ports?
System.out.println("Socket pair: (( " + localAddress.toString() + ", " + localPort + " ), ( " +
remoteAddress.toString() + ", " + remotePort + " ))");
System.out.println("Connection count is: " + connectionCount);
// The byte array here is the packet in DIS format. We put that into a // The byte array here is the packet in DIS format. We put that into a
// datagram and send it. // datagram and send it.
byte[] data = baos.toByteArray(); byte[] data = baos.toByteArray();
......
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