From 487f5ec77257264e2f0f4f1078b2fdbcca594aa5 Mon Sep 17 00:00:00 2001 From: Attila Szigeti Date: Sun, 25 Apr 2021 18:19:08 +0200 Subject: [PATCH] UPL --- server/server.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/server/server.py b/server/server.py index 8b2ee3e..2d4e0b0 100644 --- a/server/server.py +++ b/server/server.py @@ -94,13 +94,14 @@ class Server: if secondParam != "": self.networkInstance.sendMessage("ERROR".encode('UTF-8')) else: - # TODO - # Megkapod a filenevet argumentumneknt - # Fogadni kell egy uzenetet, ami a fajl tartalma - # Fogadni kell egy uzenetet, ami "EOF" - # Mindig minden legyen UTF-8-kent kodolva, kiveve a falj, az marard - # Ha sikeres, OK kuldese, kulonben ERROR kuldese - pass + fileName = firstParam + fileMessage = self.networkInstance.recieveMessage() + eof = self.networkInstance.recieveEncryptedMessage().decode('UTF-8') + if eof == "EOF": + self.executor.putFileInCurrentDirectory(fileName, fileMessage) + self.networkInstance.sendMessage("OK".encode('UTF-8')) + else: + self.networkInstance.sendMessage("ERROR".encode('UTF-8')) elif command == "DNL": if secondParam != "": self.networkInstance.sendMessage("ERROR".encode('UTF-8'))