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

warn if user tries to start client before server

parent 1ce8fc35
No related branches found
No related tags found
No related merge requests found
......@@ -97,6 +97,10 @@ public class TcpExample3Client
if (e instanceof java.net.BindException) {
System.err.println("*** Be sure to stop any other running instances of programs using this port!");
}
else if (e instanceof java.net.ConnectException)
{
System.out.println("*** Be sure to start the server before starting the client!");
}
}
finally // occurs after any other activity when shutting down
{
......
......@@ -79,6 +79,10 @@ public class TcpExample4Client
if (e instanceof java.net.BindException) {
System.out.println("*** Be sure to stop any other running instances of programs using this port!");
}
else if (e instanceof java.net.ConnectException)
{
System.out.println("*** Be sure to start the server before starting the client!");
}
}
}
}
......@@ -112,12 +112,17 @@ public class TcpSentryScenarioClient
System.out.println(prefix + " complete");
// main method now exits
} catch (IOException e) {
System.out.println("Problem with " + prefix + " networking:networking:"); // describe what is happening
System.out.println("Error: " + e);
System.out.println("*** Problem with " + prefix + "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) {
if (e instanceof java.net.BindException)
{
System.out.println("*** Be sure to stop any other running instances of programs using this port!");
}
else if (e instanceof java.net.ConnectException)
{
System.out.println("*** Be sure to start the server before starting the client!");
}
}
}
}
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