Skip to content
Snippets Groups Projects
Commit d14f291f authored by UnityGrunt03's avatar UnityGrunt03
Browse files

Merge origin/master

parents f12d4d67 5fc1edd2
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,7 @@ import java.util.Scanner; ...@@ -17,7 +17,7 @@ import java.util.Scanner;
*/ */
public class PduListenerSaver public class PduListenerSaver
{ {
private final static String DEFAULT_OUTPUTDIR = "./pduLog"; private final static String DEFAULT_OUTPUTDIR = "pduLog";
private final static String MCAST_ADDR = "239.1.2.3"; private final static String MCAST_ADDR = "239.1.2.3";
private final static int DIS_PORT = 3000; private final static int DIS_PORT = 3000;
...@@ -32,6 +32,8 @@ public class PduListenerSaver ...@@ -32,6 +32,8 @@ public class PduListenerSaver
String outDir = DEFAULT_OUTPUTDIR; String outDir = DEFAULT_OUTPUTDIR;
String mcast = MCAST_ADDR; String mcast = MCAST_ADDR;
int port = DIS_PORT; int port = DIS_PORT;
System.out.println("DisExamplesOpenDis7.PduListenerSaver started...");
switch (args.length) { switch (args.length) {
case 0: case 0:
...@@ -55,28 +57,33 @@ public class PduListenerSaver ...@@ -55,28 +57,33 @@ public class PduListenerSaver
recorder.startResume(); recorder.startResume();
mystate state = mystate.RUNNING; mystate state = mystate.RUNNING;
System.out.println("* recorder.startResume(), state=RUNNING, recording in progress...");
Scanner scan = new Scanner(System.in); Scanner scan = new Scanner(System.in);
while (true) { while (true) {
System.out.println("Type p/enter to pause, r/enter to resume, q/enter to quit"); System.out.println("Warning: you must quit when complete, otherwise recorded PDUs are lost!");
System.out.println("Type p/enter to pause, r/enter to resume, q/enter to stop recording, save and quit");
String line = scan.nextLine(); String line = scan.nextLine();
if (line.equalsIgnoreCase("p") && state == mystate.RUNNING) { if (line.equalsIgnoreCase("p") && state == mystate.RUNNING) {
recorder.stopPause(); recorder.stopPause();
state = mystate.PAUSED; state = mystate.PAUSED;
System.out.println("* recorder.stopPause(), state=PAUSED, recording paused...");
} }
else if (line.equalsIgnoreCase("r") && state == mystate.PAUSED) { else if (line.equalsIgnoreCase("r") && state == mystate.PAUSED) {
recorder.startResume(); recorder.startResume();
state = mystate.RUNNING; state = mystate.RUNNING;
System.out.println("* recorder.startResume(), state=RUNNING, recording in progress...");
} }
else if (line.equalsIgnoreCase("q")) { else if (line.equalsIgnoreCase("q")) {
recorder.end(); recorder.end();
System.out.println("* recorder.end(), recording complete.");
break; break;
} }
} }
System.out.println("Ending pdu save to "+recorder.getLogFile()); System.out.println("Ending pdu save to "+recorder.getLogFile());
} }
catch (IOException ex) { catch (IOException ex) {
System.err.println("Exception: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); System.err.println("*** Exception: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage());
} }
} }
} }
Invocation instructions:
1. run or debug PduListenerSaver.java
2. send PDUs from another program such as AllPduSender.java (used here)
3. also running AllPduReceiver can confirm that DIS replay actually occurs.
4. Type p/enter to pause, r/enter to resume, q/enter to quit
5. if Pdusave.dislog file(s) already exist, your recording will be added.
6. note existence of recorded files in directory, e.g. examples/pduLog/Pdusave.dislog
7. rename/cut/paste your recording file to keep track of your results.
Program response:
===================================================
DisExamplesOpenDis7.PduListenerSaver started...
Beginning pdu save to directory pduLog
* recorder.startResume(), state=RUNNING
Warning: you must quit when complete, otherwise recorded PDUs are lost!
Type p/enter to pause, r/enter to resume, q/enter to quit
q
Recorder log file closed
* recorder.end(), recording complete.
Ending pdu save to C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\Pdusave2.dislog
BUILD SUCCESSFUL (total time: 33 seconds)
No preview for this file type
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