Skip to content
Snippets Groups Projects
Commit f82c1969 authored by brutzman's avatar brutzman
Browse files

Provide more helpful information to user if exception occurs due to running twice at one time

parent 79fb76a9
No related branches found
No related tags found
No related merge requests found
...@@ -56,6 +56,9 @@ public class TcpExample4Client ...@@ -56,6 +56,9 @@ public class TcpExample4Client
{ {
System.out.println("Problem with TcpExample4Client, see exception trace:"); System.out.println("Problem with TcpExample4Client, see exception trace:");
System.out.println(e); 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!");
} }
} }
} }
\ No newline at end of file
...@@ -58,6 +58,9 @@ public class TcpExample4HandlerThread extends Thread ...@@ -58,6 +58,9 @@ public class TcpExample4HandlerThread extends Thread
{ {
System.out.println("Problem with TcpExample4HandlerThread, see exception trace:"); System.out.println("Problem with TcpExample4HandlerThread, see exception trace:");
System.out.println(e); 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!");
} }
} }
} }
...@@ -36,6 +36,9 @@ public class TcpExample4ThreadServer { ...@@ -36,6 +36,9 @@ public class TcpExample4ThreadServer {
{ {
System.out.println("Problem with TcpExample4ThreadServer, see exception trace:"); System.out.println("Problem with TcpExample4ThreadServer, see exception trace:");
System.out.println("Error: " + e); System.out.println("Error: " + 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!");
} }
System.out.println("============================================================="); System.out.println("=============================================================");
} }
......
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