Skip to content
Snippets Groups Projects
Commit 82e8fb33 authored by pr1n19's avatar pr1n19
Browse files

Updated messages to controller from "write" to "println" and "flush"

parent 0821cbb7
Branches
Tags
No related merge requests found
...@@ -20,7 +20,8 @@ public class DStore { ...@@ -20,7 +20,8 @@ public class DStore {
controller = new PrintWriter(socket.getOutputStream()); controller = new PrintWriter(socket.getOutputStream());
//Send "JOIN port" to controller //Send "JOIN port" to controller
controller.write("JOIN "+port); controller.println("JOIN "+port);
controller.flush();
//New thread to listen for "LIST" & "REMOVE FILENAME" //New thread to listen for "LIST" & "REMOVE FILENAME"
new Thread(() -> { new Thread(() -> {
...@@ -105,7 +106,8 @@ public class DStore { ...@@ -105,7 +106,8 @@ public class DStore {
} }
//Return value //Return value
controller.write(stringList.toString()); controller.println(stringList);
controller.flush();
} }
private static void removeFile(String filePath, String fileName){ private static void removeFile(String filePath, String fileName){
......
...@@ -36,7 +36,8 @@ public class StoreThread implements Runnable{ ...@@ -36,7 +36,8 @@ public class StoreThread implements Runnable{
fileOutput.write(buf); fileOutput.write(buf);
//Send completion ack to controller //Send completion ack to controller
controller.write("STORE_ACK "+fileName); controller.println("STORE_ACK "+fileName);
controller.flush();
//Close file output //Close file output
fileOutput.close(); fileOutput.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment