diff --git a/examples/src/TcpExamples/TcpExample4SequenceDiagram.vsdx b/examples/src/TcpExamples/TcpExample4SequenceDiagram.vsdx index a3c234843c88a8ab3ab67c1d1fbeb34b32b2c041..92a2f421ccf30be47ba4ea902d375970c622701c 100644 Binary files a/examples/src/TcpExamples/TcpExample4SequenceDiagram.vsdx and b/examples/src/TcpExamples/TcpExample4SequenceDiagram.vsdx differ diff --git a/examples/src/TcpExamples/TcpSentryClient.java b/examples/src/TcpExamples/TcpSentryClient.java index a67f953d291d692f9ad6ec962746a439fc83908f..c78896fe357999d71085aad48e02fd42b3360e8a 100644 --- a/examples/src/TcpExamples/TcpSentryClient.java +++ b/examples/src/TcpExamples/TcpSentryClient.java @@ -1,9 +1,11 @@ package TcpExamples; +import static TcpExamples.TcpSentryHandlerThread.APPROACH_THE_GATE; import static TcpExamples.TcpSentryHandlerThread.HALT_WHO_GOES_THERE; import static TcpExamples.TcpSentryHandlerThread.HOLD_IT_RIGHT_THERE; import static TcpExamples.TcpSentryHandlerThread.SENTRY_WATCH_PRESENT; import static TcpExamples.TcpSentryHandlerThread.YOU_MAY_PASS; +import static TcpExamples.TcpSentryHandlerThread.PAY_ATTENTION; import java.io.*; import java.net.*; @@ -28,7 +30,8 @@ import java.net.*; */ public class TcpSentryClient { - static String prefix = "[client] "; + /** who is speaking, by role */ + static String ACTOR = "[client] "; /** Default constructor */ public TcpSentryClient() @@ -46,12 +49,12 @@ public class TcpSentryClient try { System.out.println("==============================================================================="); - System.out.println(prefix + "startup, menu 1h.TcpSentryClient, " + TcpSentryClient.class.getName()); - System.out.println(prefix + "up to " + MAX_LOOP_COUNT + " visitors may approach."); + System.out.println(ACTOR + "startup, menu 1h.TcpSentryClient, " + TcpSentryClient.class.getName()); + System.out.println(ACTOR + "up to " + MAX_LOOP_COUNT + " visitors may approach."); System.out.println("==============================================================================="); for (int loopCount = 1; loopCount <= MAX_LOOP_COUNT; loopCount++) // loop then exit { - System.out.println(prefix + "creating client side to connect new socket #" + loopCount + "..."); + System.out.println(ACTOR + "creating client side to connect new socket #" + loopCount + "..."); // We request an IP to connect to ("localhost") and // port number at that IP (2317). This establishes @@ -64,7 +67,7 @@ public class TcpSentryClient //////////////////////////////////////////////////////////////////////////////////////////// // Assignment code - String myName; + String myName = new String(); // input stream and output stream InputStream socketInputStream = socket.getInputStream(); Reader socketInputStreamReader = new InputStreamReader(socketInputStream); @@ -81,52 +84,66 @@ public class TcpSentryClient if (sentryQuery.endsWith(SENTRY_WATCH_PRESENT)) { // duly noted, do not respond to this and continue looping/processing - System.out.println (prefix + "(no response)"); + System.out.println (ACTOR + "(no response, observing situation)"); } - else if (sentryQuery.contains("Hello")) + else if (sentryQuery.toLowerCase().contains("hello")) { - System.out.println (prefix + "Hello officer."); + if (!myName.isBlank()) + System.out.println (ACTOR + "(" + myName + ") Hello officer."); + else System.out.println (ACTOR + " Hello officer."); // anonymous + } + else if (sentryQuery.endsWith(APPROACH_THE_GATE)) + { + // duly noted, do not respond to this and drive forward + System.out.println (ACTOR + "(no response, driving forward to gate)"); } else if (sentryQuery.endsWith(HALT_WHO_GOES_THERE)) { System.out.println ("(visitors should type their name here)"); // user provides name from console myName = System.console().readLine(); // this line blocks, awaiting keyboard input from user - socketPrintStream.println(prefix + myName); // send it back to dispatch server + socketPrintStream.println(ACTOR + myName); // send it back to dispatch server // System.out.println ("[trace] console return: " + myName); if (myName.equalsIgnoreCase("quit") || myName.equalsIgnoreCase("exit")) { socketPrintStream.flush(); // ensure this final message goes through the socket - System.out.println (prefix + "Exiting the program."); + System.out.println (ACTOR + "Exiting the program."); socket.close(); System.exit(0); } } + else if (sentryQuery.endsWith(PAY_ATTENTION)) + { + // better listen better, the prior query wasn't handled together + // no response expected or provided + } else if (sentryQuery.endsWith(YOU_MAY_PASS)) { - System.out.println (prefix + "Thank you officer."); + System.out.println (ACTOR + "Thank you officer."); break; } else if (sentryQuery.endsWith(HOLD_IT_RIGHT_THERE)) { - System.out.println (prefix + "OK I am outta here!"); + System.out.println (ACTOR + "OK I am outta here!"); break; } // handling unexpected cases is important - else System.out.println (prefix + "I'm not sure what that means, say again please..."); - } + else System.out.println (ACTOR + "I'm not sure what that means, say again please..."); + + } // continue looping until termination event occurs + System.out.println("==============================================================================="); - // To push this further, launch multiple copies of TcpSentryClient simultaneously + // To push the sentry software further, launch multiple copies of this TcpSentryClient simultaneously } //////////////////////////////////////////////////////////////////////////////////////////// - System.out.println(prefix + " complete"); + System.out.println(ACTOR + " complete"); // main method now exits } catch (IOException e) { - System.out.println("*** " + prefix + "Problem with networking,"); // describe what is happening + System.out.println("*** " + ACTOR + "Problem with networking,"); // describe what is happening System.out.println(" " + e); // Provide more helpful information to user if exception occurs due to running twice at one time if (e instanceof java.net.BindException) @@ -140,7 +157,7 @@ public class TcpSentryClient } finally { - System.out.println("pau, all done"); + System.out.println(TcpSentryClient.class.getName() + " all done."); } } } diff --git a/examples/src/TcpExamples/TcpSentryDispatchServer.java b/examples/src/TcpExamples/TcpSentryDispatchServer.java index 8debd4a06adbaeec9dc838896f942ab4fa678d17..b2def7fdf2f1c82fe3b3db712f4e35ae6f95dbc3 100644 --- a/examples/src/TcpExamples/TcpSentryDispatchServer.java +++ b/examples/src/TcpExamples/TcpSentryDispatchServer.java @@ -24,7 +24,8 @@ import java.net.*; */ public class TcpSentryDispatchServer { - static String prefix = "[dispatcher] "; + /** who is speaking, by role */ + static String ACTOR = "[dispatcher] "; /** Default constructor */ public TcpSentryDispatchServer() @@ -45,11 +46,11 @@ public class TcpSentryDispatchServer int connectionCount = 0; // state variable System.out.println("==============================================================================="); - System.out.println(prefix + "startup, menu 1g.TcpSentryServer, " + TcpSentryDispatchServer.class.getName()); + System.out.println(ACTOR + "startup, menu 1g.TcpSentryServer, " + TcpSentryDispatchServer.class.getName()); while (true) // infinite loop, handling client connections and dispatching another handler thread { - System.out.println(prefix + "waiting and ready to accept socket connection from a new client..."); + System.out.println(ACTOR + "waiting and ready to accept socket connection from a new client..."); serverSocketConnection = serverSocket.accept(); // block! until connected connectionCount++; // now unblocked, we have gotten another connection @@ -59,19 +60,19 @@ public class TcpSentryDispatchServer // Plenty of code in Example3, we instead let our proxy thread // TcpSentryHandlerThread introduce itself to the client. - System.out.println(prefix + "received socket connection, creating handlerThread for visitor #" + connectionCount + "..."); + System.out.println(ACTOR + "received socket connection, creating handlerThread for visitor #" + connectionCount + "..."); // hand off this aready-created and connected socket to constructor sentryHandlerThread = new TcpSentryHandlerThread(serverSocketConnection); // creation logs a message sentryHandlerThread.start();// invokes the run() method in that object, which sends initial reply on the socket - System.out.println(prefix + "a new sentry is now dispatched and running, using socket connection #" + connectionCount); + System.out.println(ACTOR + "a new sentry is now dispatched and running, using socket connection #" + connectionCount); System.out.println("==============================================================================="); // while(true) continue looping, serverSocket is still waiting for another customer client } } catch (IOException e) { - System.out.println("*** " + prefix + "Problem with networking,"); // describe what is happening + System.out.println("*** " + ACTOR + "Problem with networking,"); // describe what is happening System.out.println(" " + e); // Provide more helpful information to user if exception occurs due to running twice at one time if (e instanceof java.net.BindException) { @@ -79,6 +80,10 @@ public class TcpSentryDispatchServer } System.exit(-1); } + finally + { + System.out.println(TcpSentryDispatchServer.class.getName() + " all done."); + } System.out.println("==============================================================================="); // execution complete } } diff --git a/examples/src/TcpExamples/TcpSentryHandlerThread.java b/examples/src/TcpExamples/TcpSentryHandlerThread.java index c1dbf328c7d799ddf386a3ad79d2edf1d721a4a3..28dbc804f005d3225daa46c9f7c6472f64238eb7 100644 --- a/examples/src/TcpExamples/TcpSentryHandlerThread.java +++ b/examples/src/TcpExamples/TcpSentryHandlerThread.java @@ -33,22 +33,30 @@ import java.util.List; */ public class TcpSentryHandlerThread extends Thread { + /** who is speaking, by role */ + static final String ACTOR = "[sentry] "; + /** Sentry Scenario access list, as written this list is case sensitive. * See <a href="https://stackoverflow.com/questions/1005073/initialization-of-an-arraylist-in-one-line" target="blank">https://stackoverflow.com/questions/1005073/initialization-of-an-arraylist-in-one-line</a> */ public static List<String> allowedNamesList = Arrays.asList("Tim", "Stephen", "Mark", "Rene", "Simon", "James", "Ethan", "Jin Hong", "Don"); - /** Sentry command vocabulary */ + /** Sentry command vocabulary: the guard is out of the house! */ public static final String SENTRY_WATCH_PRESENT = "Announcement: the sentry watch is present and standing guard."; - /** Sentry command vocabulary */ + /** Sentry command vocabulary: hand signal or loud statement (across the standoff distance) to next vehicle waiting at STOP sign */ + public static final String APPROACH_THE_GATE = "(verbal or hand gesture) You may approach the gate."; + /** Sentry command vocabulary: use a standard admonition for broad recognition by visitors */ public static final String HALT_WHO_GOES_THERE = "Halt who goes there?"; /** Sentry command vocabulary */ public static final String YOU_MAY_PASS = "You may pass, have a great MOVES day!"; /** Sentry command vocabulary */ public static final String HOLD_IT_RIGHT_THERE = "You may not pass! Leave immediately or else..."; + /** Sentry command vocabulary */ + public static final String PAY_ATTENTION = "Did you hear me? Pay attention please."; - private static final String prefix = "[sentry] "; + /** TODO, not implemented: visitor ignores the sentry's direction to leave and enters the base */ + public static final String INTRUDER_ALERT = "An unauthorized visitor has entered the base!"; /** The socket connection to a client */ Socket socket; @@ -62,7 +70,7 @@ public class TcpSentryHandlerThread extends Thread TcpSentryHandlerThread(Socket socket) { this.socket = socket; - System.out.println(prefix + "1h.TcpSentryClient, " + TcpSentryHandlerThread.class.getName()); + System.out.println(ACTOR + "1h.TcpSentryClient, " + TcpSentryHandlerThread.class.getName()); } /** * Program invocation and execution starts here - but is illegal and unwanted, so warn the unsuspecting user! @@ -71,7 +79,9 @@ public class TcpSentryHandlerThread extends Thread public static void main(String[] args) { System.out.println ("*** TcpSentryHandlerThread is not a standalone executable progam."); - System.out.println ("*** Please run TcpSentryDispatchServer instead... now exiting."); + System.out.println ("*** Please run TcpSentryDispatchServer instead... now handing the baton back to the boss."); + TcpSentryDispatchServer.main(new String[] { /* dummy args */ }); + // exit } /** Handles one connection. We add an artificial slowness @@ -84,7 +94,7 @@ public class TcpSentryHandlerThread extends Thread { try { - System.out.println(prefix + "startup, menu 1g.TcpSentryServer, " + TcpSentryHandlerThread.class.getName()); + System.out.println(ACTOR + "startup, menu 1g.TcpSentryServer, " + TcpSentryHandlerThread.class.getName()); // now starting to handle the thread // setup input stream and output stream @@ -105,60 +115,83 @@ public class TcpSentryHandlerThread extends Thread // since this thread is running, a socket connection has already been received from dispatch server. // PrintStream is the Java way to use System.print() to pass string data along the socket. - socketPrintStream.println(prefix + SENTRY_WATCH_PRESENT); - System.out.println(prefix + SENTRY_WATCH_PRESENT); + socketPrintStream.println(ACTOR + SENTRY_WATCH_PRESENT); + System.out.println(ACTOR + SENTRY_WATCH_PRESENT); // make sure that message indeed escapes current process and is pushed through socket to reach the client socketPrintStream.flush(); // now the query-response interactions begin... - socketPrintStream.println(prefix + HALT_WHO_GOES_THERE); - System.out.println(prefix + HALT_WHO_GOES_THERE); + socketPrintStream.println(ACTOR + APPROACH_THE_GATE); + System.out.println(ACTOR + APPROACH_THE_GATE); + + // No communications response occurs, instead the visitor drives up to the gate + + socketPrintStream.println(ACTOR + HALT_WHO_GOES_THERE); + System.out.println(ACTOR + HALT_WHO_GOES_THERE); String clientResponse = socketBufferedReader.readLine(); System.out.println (clientResponse); - // trim prefix if neccessary + // trim actor prefix if neccessary int messageIndex = clientResponse.indexOf("]"); if (messageIndex > 0) clientResponse = clientResponse.substring(messageIndex + 1).trim(); + while (clientResponse.isBlank()) // repeat if needed + { + socketPrintStream.println(ACTOR + PAY_ATTENTION); + System.out.println(ACTOR + PAY_ATTENTION); + socketPrintStream.println(ACTOR + HALT_WHO_GOES_THERE); + System.out.println(ACTOR + HALT_WHO_GOES_THERE); + clientResponse = socketBufferedReader.readLine(); + System.out.println (clientResponse); + // trim actor prefix if neccessary + messageIndex = clientResponse.indexOf("]"); + if (messageIndex > 0) + clientResponse = clientResponse.substring(messageIndex + 1).trim(); + } + if (clientResponse.trim().equalsIgnoreCase("quit") || clientResponse.trim().equalsIgnoreCase("exit")) { - System.out.println (prefix + "Exiting the program."); + System.out.println (ACTOR + "Exiting the program."); socket.close(); System.exit(0); // shuts down thread, not dispatch server } // simple response - socketPrintStream.println(prefix + "Hello, " + clientResponse); - System.out.println(prefix + "Hello, " + clientResponse); + socketPrintStream.println(ACTOR + "Hello, " + clientResponse); + System.out.println(ACTOR + "Hello, " + clientResponse); // now check credential and respond accordingly if (allowedNamesList.contains(clientResponse)) { - socketPrintStream.println(prefix + YOU_MAY_PASS); - System.out.println(prefix + YOU_MAY_PASS); + socketPrintStream.println(ACTOR + YOU_MAY_PASS); + System.out.println(ACTOR + YOU_MAY_PASS); } else { - socketPrintStream.println(prefix + HOLD_IT_RIGHT_THERE); - System.out.println(prefix + HOLD_IT_RIGHT_THERE); + socketPrintStream.println(ACTOR + HOLD_IT_RIGHT_THERE); + System.out.println(ACTOR + HOLD_IT_RIGHT_THERE); } //////////////////////////////////////////////////////////////////////////////////////////// // socket.close(); // all clear, no longer need socket - System.out.println(prefix + "this visitor interaction is complete."); + System.out.println(ACTOR + "this visitor interaction is complete."); System.out.println("================================================================================="); // execution complete } catch(IOException | InterruptedException e) // either a networking or a threading problem { - System.out.println("*** " + prefix + "Problem with networking,"); // describe what is happening + System.out.println("*** " + ACTOR + "Problem with networking,"); // describe what is happening System.out.println(" " + e); // Provide more helpful information to user if exception occurs due to running twice at one time if (e instanceof java.net.BindException) System.out.println("*** Be sure to stop any other running instances of programs using this port!"); } + finally + { + System.out.println(TcpSentryHandlerThread.class.getName() + " all done."); + } } } diff --git a/examples/src/TcpExamples/TcpSentrySequenceDiagram.png b/examples/src/TcpExamples/TcpSentrySequenceDiagram.png index 47c5bee07c73f878471751bbab22936ebd01b507..fab9ca0f5991696af1dc2088bf58c682f68fe877 100644 Binary files a/examples/src/TcpExamples/TcpSentrySequenceDiagram.png and b/examples/src/TcpExamples/TcpSentrySequenceDiagram.png differ diff --git a/examples/src/TcpExamples/TcpSentryTerminalLog.txt b/examples/src/TcpExamples/TcpSentryTerminalLog.txt index 7fd4ab2718ac167983b6bcd1b2b585d67dde5784..a99d8ba577500c96e750ec751718f70dbf8a5f38 100644 --- a/examples/src/TcpExamples/TcpSentryTerminalLog.txt +++ b/examples/src/TcpExamples/TcpSentryTerminalLog.txt @@ -4,17 +4,105 @@ Invocation instructions: Program responses: -TcpSentryServer ---------------- -ant -f C:\\x3d-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run run + +TcpSentryClient +--------------------------------------- +ant -f C:\\x3d-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run.single -Djavac.includes=TcpExamples/TcpSentryClient.java -Drun.class=TcpExamples.TcpSentryClient run-single +init: +Deleting: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties +deps-jar: +Updating property file: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties +Compiling 1 source file to C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes +compile-single: +run-single: +=============================================================================== +[client] startup, menu 1h.TcpSentryClient, TcpExamples.TcpSentryClient +[client] up to 6 visitors may approach. +=============================================================================== +[client] creating client side to connect new socket #1... +[sentry] Announcement: the sentry watch is present and standing guard. +[client] (no response, observing situation) +[sentry] (verbal or hand gesture) You may approach the gate. +[client] (no response, driving forward to gate) +[sentry] Halt who goes there? +(visitors should type their name here) +Don +[sentry] Hello, Don +[client] (Don) Hello officer. +[sentry] You may pass, have a great MOVES day! +[client] Thank you officer. +=============================================================================== +[client] creating client side to connect new socket #2... +[sentry] Announcement: the sentry watch is present and standing guard. +[client] (no response, observing situation) +[sentry] (verbal or hand gesture) You may approach the gate. +[client] (no response, driving forward to gate) +[sentry] Halt who goes there? +(visitors should type their name here) +don +[sentry] Hello, don +[client] (don) Hello officer. +[sentry] You may not pass! Leave immediately or else... +[client] OK I am outta here! +=============================================================================== +[client] creating client side to connect new socket #3... +[sentry] Announcement: the sentry watch is present and standing guard. +[client] (no response, observing situation) +[sentry] (verbal or hand gesture) You may approach the gate. +[client] (no response, driving forward to gate) +[sentry] Halt who goes there? +(visitors should type their name here) + +[sentry] Did you hear me? Pay attention please. +[sentry] Halt who goes there? +(visitors should type their name here) + +[sentry] Did you hear me? Pay attention please. +[sentry] Halt who goes there? +(visitors should type their name here) +random_visitor +[sentry] Hello, random_visitor +[client] (random_visitor) Hello officer. +[sentry] You may not pass! Leave immediately or else... +[client] OK I am outta here! +=============================================================================== +[client] creating client side to connect new socket #4... +[sentry] Announcement: the sentry watch is present and standing guard. +[client] (no response, observing situation) +[sentry] (verbal or hand gesture) You may approach the gate. +[client] (no response, driving forward to gate) +[sentry] Halt who goes there? +(visitors should type their name here) +Tim +[sentry] Hello, Tim +[client] (Tim) Hello officer. +[sentry] You may pass, have a great MOVES day! +[client] Thank you officer. +=============================================================================== +[client] creating client side to connect new socket #5... +[sentry] Announcement: the sentry watch is present and standing guard. +[client] (no response, observing situation) +[sentry] (verbal or hand gesture) You may approach the gate. +[client] (no response, driving forward to gate) +[sentry] Halt who goes there? +(visitors should type their name here) +quit +[client] Exiting the program. +BUILD SUCCESSFUL (total time: 2 minutes 3 seconds) + +--------------------------------------- + +TcpSentryServer, TcpSentryHandlerThread +--------------------------------------- +ant -f C:\\x3d-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=debug.single -Djavac.includes=TcpExamples/TcpSentryHandlerThread.java -Ddebug.class=TcpExamples.TcpSentryHandlerThread debug-single init: Deleting: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties deps-jar: Updating property file: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties -Compiling 3 source files to C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes -Copying 1 file to C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes -compile: -run: +Compiling 1 source file to C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\classes +compile-single: +*** TcpSentryHandlerThread is not a standalone executable progam. +*** Please run TcpSentryDispatchServer instead... now handing the baton back to the boss. =============================================================================== [dispatcher] startup, menu 1g.TcpSentryServer, TcpExamples.TcpSentryDispatchServer [dispatcher] waiting and ready to accept socket connection from a new client... @@ -25,12 +113,14 @@ run: [dispatcher] waiting and ready to accept socket connection from a new client... [sentry] startup, menu 1g.TcpSentryServer, TcpExamples.TcpSentryHandlerThread [sentry] Announcement: the sentry watch is present and standing guard. +[sentry] (verbal or hand gesture) You may approach the gate. [sentry] Halt who goes there? -[client] joe -[sentry] Hello, joe -[sentry] You may not pass! Leave immediately or else... +[client] Don +[sentry] Hello, Don +[sentry] You may pass, have a great MOVES day! [sentry] this visitor interaction is complete. ================================================================================= +TcpExamples.TcpSentryHandlerThread all done. [dispatcher] received socket connection, creating handlerThread for visitor #2... [sentry] 1h.TcpSentryClient, TcpExamples.TcpSentryHandlerThread [dispatcher] a new sentry is now dispatched and running, using socket connection #2 @@ -38,12 +128,14 @@ run: [dispatcher] waiting and ready to accept socket connection from a new client... [sentry] startup, menu 1g.TcpSentryServer, TcpExamples.TcpSentryHandlerThread [sentry] Announcement: the sentry watch is present and standing guard. +[sentry] (verbal or hand gesture) You may approach the gate. [sentry] Halt who goes there? [client] don [sentry] Hello, don [sentry] You may not pass! Leave immediately or else... [sentry] this visitor interaction is complete. ================================================================================= +TcpExamples.TcpSentryHandlerThread all done. [dispatcher] received socket connection, creating handlerThread for visitor #3... [sentry] 1h.TcpSentryClient, TcpExamples.TcpSentryHandlerThread [dispatcher] a new sentry is now dispatched and running, using socket connection #3 @@ -51,12 +143,20 @@ run: [dispatcher] waiting and ready to accept socket connection from a new client... [sentry] startup, menu 1g.TcpSentryServer, TcpExamples.TcpSentryHandlerThread [sentry] Announcement: the sentry watch is present and standing guard. +[sentry] (verbal or hand gesture) You may approach the gate. [sentry] Halt who goes there? -[client] Don -[sentry] Hello, Don -[sentry] You may pass, have a great MOVES day! +[client] +[sentry] Did you hear me? Pay attention please. +[sentry] Halt who goes there? +[client] +[sentry] Did you hear me? Pay attention please. +[sentry] Halt who goes there? +[client] random_visitor +[sentry] Hello, random_visitor +[sentry] You may not pass! Leave immediately or else... [sentry] this visitor interaction is complete. ================================================================================= +TcpExamples.TcpSentryHandlerThread all done. [dispatcher] received socket connection, creating handlerThread for visitor #4... [sentry] 1h.TcpSentryClient, TcpExamples.TcpSentryHandlerThread [dispatcher] a new sentry is now dispatched and running, using socket connection #4 @@ -64,64 +164,26 @@ run: [dispatcher] waiting and ready to accept socket connection from a new client... [sentry] startup, menu 1g.TcpSentryServer, TcpExamples.TcpSentryHandlerThread [sentry] Announcement: the sentry watch is present and standing guard. +[sentry] (verbal or hand gesture) You may approach the gate. [sentry] Halt who goes there? -[client] exit -[sentry] Exiting the program. -BUILD SUCCESSFUL (total time: 54 seconds) ---------------- - -TcpSentryClient ---------------- -ant -f C:\\x3d-nps-gitlab\\NetworkedGraphicsMV3500\\examples -Dnb.internal.action.name=run run -init: -Deleting: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties -deps-jar: -Updating property file: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\build\built-jar.properties -compile: -run: -=============================================================================== -[client] startup, menu 1h.TcpSentryClient, TcpExamples.TcpSentryClient -[client] up to 6 visitors may approach. -=============================================================================== -[client] creating client side to connect new socket #1... -[sentry] Announcement: the sentry watch is present and standing guard. -[client] (no response) -[sentry] Halt who goes there? -(visitors should type their name here) -joe -[sentry] Hello, joe -[client] Hello officer. -[sentry] You may not pass! Leave immediately or else... -[client] OK I am outta here! -=============================================================================== -[client] creating client side to connect new socket #2... -[sentry] Announcement: the sentry watch is present and standing guard. -[client] (no response) -[sentry] Halt who goes there? -(visitors should type their name here) -don -[sentry] Hello, don -[client] Hello officer. -[sentry] You may not pass! Leave immediately or else... -[client] OK I am outta here! -=============================================================================== -[client] creating client side to connect new socket #3... -[sentry] Announcement: the sentry watch is present and standing guard. -[client] (no response) -[sentry] Halt who goes there? -(visitors should type their name here) -Don -[sentry] Hello, Don -[client] Hello officer. +[client] Tim +[sentry] Hello, Tim [sentry] You may pass, have a great MOVES day! -[client] Thank you officer. +[sentry] this visitor interaction is complete. +================================================================================= +TcpExamples.TcpSentryHandlerThread all done. +[dispatcher] received socket connection, creating handlerThread for visitor #5... +[sentry] 1h.TcpSentryClient, TcpExamples.TcpSentryHandlerThread +[dispatcher] a new sentry is now dispatched and running, using socket connection #5 =============================================================================== -[client] creating client side to connect new socket #4... +[dispatcher] waiting and ready to accept socket connection from a new client... +[sentry] startup, menu 1g.TcpSentryServer, TcpExamples.TcpSentryHandlerThread [sentry] Announcement: the sentry watch is present and standing guard. -[client] (no response) +[sentry] (verbal or hand gesture) You may approach the gate. [sentry] Halt who goes there? -(visitors should type their name here) -exit -[client] Exiting the program. -BUILD SUCCESSFUL (total time: 32 seconds) ---------------- +[client] quit +[sentry] Exiting the program. +debug-single: +BUILD SUCCESSFUL (total time: 2 minutes 23 seconds) + +---------------------------------------