fix file_transfer

This commit is contained in:
algobytewise 2021-03-23 12:15:38 +05:30
parent 730cf6d173
commit 06c8abcd70
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ if __name__ == "__main__":
print("Receiving data...")
while True:
data = sock.recv(1024)
print(f"data={data}")
print(f"data={str(data)}")
if not data:
break
out_file.write(data) # Write data to a file

View File

@ -13,7 +13,7 @@ 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)
print(f"Server received {data}")
print(f"Server received {str(data)}")
with open(filename, "rb") as in_file:
data = in_file.read(1024)