diff --git a/file_transfer/send_file.py b/file_transfer/send_file.py
index 1c56e48f47a1..1084f4fe1449 100644
--- a/file_transfer/send_file.py
+++ b/file_transfer/send_file.py
@@ -13,6 +13,8 @@ def send_file(filename: str = "mytext.txt", testing: bool = False) -> None:
         conn, addr = sock.accept()  # Establish connection with client.
         print(f"Got connection from {addr}")
         data = conn.recv(1024)
+        if not data:
+            break  # IF NOT data received,the Client has closed the Connection.
         print(f"Server received: {data = }")
 
         with open(filename, "rb") as in_file: