mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 23:11:09 +00:00
fix file_transfer
This commit is contained in:
parent
730cf6d173
commit
06c8abcd70
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user