Skip to content
Snippets Groups Projects
Commit 63811a6d authored by Dominik Fuhrmann's avatar Dominik Fuhrmann
Browse files

mnore logs

parent ee6f3e4f
No related branches found
No related tags found
No related merge requests found
...@@ -12,16 +12,21 @@ def run_client(file_path): ...@@ -12,16 +12,21 @@ def run_client(file_path):
# Sichere Verbindung mit dem Server herstellen # Sichere Verbindung mit dem Server herstellen
try: try:
print("Versuche, Verbindung zum Server herzustellen...")
with socket.create_connection(("192.168.125.101", 5000)) as sock: 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: 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 # Datei senden
print(f"Beginne mit dem Senden der Datei '{file_path}'...")
with open(file_path, "rb") as f: with open(file_path, "rb") as f:
total_bytes_sent = 0
while chunk := f.read(1024): while chunk := f.read(1024):
ssl_sock.sendall(chunk) 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: except Exception as e:
print(f"Fehler bei der Verbindung zum Server: {e}") print(f"Fehler bei der Verbindung zum Server: {e}")
......
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