From 63811a6def79cb437d3fe66679cde193c9f0d61f Mon Sep 17 00:00:00 2001 From: Dominik Fuhrmann <dominik.fuhrmann1@gmail.com> Date: Tue, 24 Dec 2024 13:34:00 +0100 Subject: [PATCH] mnore logs --- communicationScripts/client.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/communicationScripts/client.py b/communicationScripts/client.py index 8410ba6..406e683 100644 --- a/communicationScripts/client.py +++ b/communicationScripts/client.py @@ -12,16 +12,21 @@ def run_client(file_path): # Sichere Verbindung mit dem Server herstellen try: + print("Versuche, Verbindung zum Server herzustellen...") with socket.create_connection(("192.168.125.101", 5000)) as sock: - print("Verbindung zum Server wird hergestellt...") + print("Verbindung zum Server erfolgreich hergestellt.") with context.wrap_socket(sock, server_hostname="192.168.125.101") as ssl_sock: - print("Mit dem Server verbunden!") + print("Mit dem Server verbunden und SSL-Handschlag abgeschlossen!") # Datei senden + print(f"Beginne mit dem Senden der Datei '{file_path}'...") with open(file_path, "rb") as f: + total_bytes_sent = 0 while chunk := f.read(1024): ssl_sock.sendall(chunk) - print(f"Datei '{file_path}' erfolgreich an den Server gesendet.") + total_bytes_sent += len(chunk) + print(f"Datei '{file_path}' erfolgreich an den Server gesendet. ({total_bytes_sent} Bytes)") + except Exception as e: print(f"Fehler bei der Verbindung zum Server: {e}") -- GitLab