Skip to content
Snippets Groups Projects
Commit 6376342f authored by markm's avatar markm
Browse files

Looks like some modifications didn't go through. Redoing.

parent fb26f95e
No related branches found
No related tags found
No related merge requests found
......@@ -56,7 +56,7 @@ public class Matiski2HandlerThread extends Thread
* the client won't see a server connection response for ten seconds (default).
*/
// @overriding run() method in Java Thread class is deliberate
@Override
@Override
public void run()
{
try
......@@ -78,7 +78,8 @@ public void run()
String clientPassword = br.readLine(); // Read the password sent by the client
if (correctPassword.equals(clientPassword)) {
boolean isPasswordCorrect = correctPassword.equals(clientPassword);
if (isPasswordCorrect) {
ps.println("Password accepted. Processing your request...");
ps.flush();
......@@ -95,6 +96,14 @@ public void run()
ps.flush();
}
// Inform the client that the connection will be closed
if (isPasswordCorrect) {
ps.println("Your request has been processed. The connection will now be closed.");
} else {
ps.println("Due to incorrect password, the connection will be closed.");
}
ps.flush();
socket.close(); // Close the socket after handling the connection
System.out.println(Matiski2HandlerThread.class.getName() + " finished handling a thread, now exit.");
}
......@@ -107,4 +116,5 @@ public void run()
System.out.println("*** Be sure to stop any other running instances of programs using this port!");
}
}
}
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