From 58bb6f67bfdb90dc28bbc8bba63c366edd585667 Mon Sep 17 00:00:00 2001
From: cs2017 <cs2017@DESKTOP-C0KH063.ern.nps.edu>
Date: Thu, 8 Mar 2018 14:12:42 -0800
Subject: [PATCH] AngelBlank upto but not including filter

---
 .../ABEspduReceiverAtoTCP.java                | 26 +++++++++++--------
 .../ABEspduReceiverBtoTCP.java                | 25 ++++++++++--------
 .../AngelBlankEspduSenderB.java               |  4 +--
 3 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/ABEspduReceiverAtoTCP.java b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/ABEspduReceiverAtoTCP.java
index b634020ae1..fb2bb36f69 100644
--- a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/ABEspduReceiverAtoTCP.java
+++ b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/ABEspduReceiverAtoTCP.java
@@ -46,16 +46,6 @@ public class ABEspduReceiverAtoTCP {
             while (true) {
                 try
                 {
-                                    // Create TCP Bridge
-                System.out.println("Opening Bridge.");
-
-                Socket clientConnection = new Socket("localhost", TCP_DESTINATION_PORT); 
-                OutputStream os = clientConnection.getOutputStream();
-                PrintStream ps = new PrintStream(os);
-
-                //ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                //DataOutputStream dos = new DataOutputStream(baos);
-                System.out.println("Bridging Complete.");
 
                 byte buffer[] = new byte[MAX_PDU_SIZE];
                 packet = new DatagramPacket(buffer, buffer.length);
@@ -73,10 +63,23 @@ public class ABEspduReceiverAtoTCP {
                 {
                     Pdu aPdu = (Pdu)it.next();
                 
-                    System.out.print("got PDU of type: " + aPdu.getClass().getName());
+                   // System.out.print("got PDU of type: " + aPdu.getClass().getName());
                     if(aPdu instanceof EntityStatePdu)
                     {
+
                         EntityID eid = ((EntityStatePdu)aPdu).getEntityID();
+                        if (eid.getSite() == 100){
+                                                                                        // Create TCP Bridge
+                System.out.println("Opening Bridge.");
+
+                Socket clientConnection = new Socket("localhost", TCP_DESTINATION_PORT); 
+                OutputStream os = clientConnection.getOutputStream();
+                PrintStream ps = new PrintStream(os);
+
+                //ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                //DataOutputStream dos = new DataOutputStream(baos);
+                System.out.println("Bridging Complete.");
+
                         EntityType entityType = ((EntityStatePdu)aPdu).getEntityType();
                         ps.println(eid.getSite());
                         ps.println(eid.getApplication());
@@ -91,6 +94,7 @@ public class ABEspduReceiverAtoTCP {
                         Vector3Double position = ((EntityStatePdu)aPdu).getEntityLocation();
                         System.out.print(" EID:[" + eid.getSite() + ", " + eid.getApplication() + ", " + eid.getEntity() + "] ");
                         System.out.print(" Location in DIS coordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]");
+                        }
                     }
                     System.out.println();
                 } // end trop through PDU bundle
diff --git a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/ABEspduReceiverBtoTCP.java b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/ABEspduReceiverBtoTCP.java
index b5a4a7c453..60106c797e 100644
--- a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/ABEspduReceiverBtoTCP.java
+++ b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/ABEspduReceiverBtoTCP.java
@@ -46,16 +46,6 @@ public class ABEspduReceiverBtoTCP {
             while (true) {
                 try
                 {
-                                    // Create TCP Bridge
-                System.out.println("Opening Bridge.");
-
-                Socket clientConnection = new Socket("localhost", TCP_DESTINATION_PORT); 
-                OutputStream os = clientConnection.getOutputStream();
-                PrintStream ps = new PrintStream(os);
-
-                //ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                //DataOutputStream dos = new DataOutputStream(baos);
-                System.out.println("Bridging Complete.");
 
                 byte buffer[] = new byte[MAX_PDU_SIZE];
                 packet = new DatagramPacket(buffer, buffer.length);
@@ -73,10 +63,22 @@ public class ABEspduReceiverBtoTCP {
                 {
                     Pdu aPdu = (Pdu)it.next();
                 
-                    System.out.print("got PDU of type: " + aPdu.getClass().getName());
+                    //System.out.print("got PDU of type: " + aPdu.getClass().getName());
                     if(aPdu instanceof EntityStatePdu)
                     {
                         EntityID eid = ((EntityStatePdu)aPdu).getEntityID();
+                        if (eid.getSite() == 200){
+                                                                // Create TCP Bridge
+                System.out.println("Opening Bridge.");
+
+                Socket clientConnection = new Socket("localhost", TCP_DESTINATION_PORT); 
+                OutputStream os = clientConnection.getOutputStream();
+                PrintStream ps = new PrintStream(os);
+
+                //ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                //DataOutputStream dos = new DataOutputStream(baos);
+                System.out.println("Bridging Complete.");
+
                         EntityType entityType = ((EntityStatePdu)aPdu).getEntityType();
                         ps.println(eid.getSite());
                         ps.println(eid.getApplication());
@@ -91,6 +93,7 @@ public class ABEspduReceiverBtoTCP {
                         Vector3Double position = ((EntityStatePdu)aPdu).getEntityLocation();
                         System.out.print(" EID:[" + eid.getSite() + ", " + eid.getApplication() + ", " + eid.getEntity() + "] ");
                         System.out.print(" Location in DIS coordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]");
+                        }
                     }
                     System.out.println();
                 } // end trop through PDU bundle
diff --git a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduSenderB.java b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduSenderB.java
index df64239631..d251d568b9 100644
--- a/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduSenderB.java
+++ b/projects/Assignments/FinalProjects/2018March/AngelopoulosBlankenbeker/AngelBlankEspduSenderB.java
@@ -237,8 +237,8 @@ public static void main(String args[])
             DataOutputStream dos = new DataOutputStream(baos);
             espdu.marshal(dos);
 
-            FirePdu fire = new FirePdu();
-            byte[] fireArray = fire.marshal();
+            //FirePdu fire = new FirePdu();
+            //byte[] fireArray = fire.marshal();
               
                 
             // The byte array here is the packet in DIS format. We put that into a 
-- 
GitLab