attempt at removing tqdm dependency
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
import socket
|
||||
import os
|
||||
import tqdm
|
||||
|
||||
# device's IP address
|
||||
SERVER_HOST = "127.0.0.1" #(socket.gethostbyname(socket.gethostname()))
|
||||
SERVER_PORT = 5001
|
||||
# receive 4096 bytes each time
|
||||
BUFFER_SIZE = 4096
|
||||
BUFFER_SIZE = 128
|
||||
SEPARATOR = "<SEPARATOR>"
|
||||
# create the server socket
|
||||
# TCP socket
|
||||
@ -31,7 +31,7 @@ filename = os.path.basename(filename)
|
||||
filesize = int(filesize)
|
||||
# start receiving the file from the socket
|
||||
# and writing to the file stream
|
||||
progress = tqdm.tqdm(range(filesize), f"Receiving {filename}", unit="B", unit_scale=True, unit_divisor=1024)
|
||||
progress = "_"
|
||||
#with open(filename, "wb") as f:
|
||||
|
||||
while True:
|
||||
@ -46,8 +46,6 @@ while True:
|
||||
f = open(filename, 'ab')
|
||||
f.write(bytes_read)
|
||||
print(bytes_read)
|
||||
# update the progress bar
|
||||
progress.update(len(bytes_read))
|
||||
f.close()
|
||||
|
||||
# close the client socket
|
||||
|
Reference in New Issue
Block a user