mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-04-06 03:58:02 +08:00
Slight code reorganization in servefiles.
This commit is contained in:
parent
22b26c2f34
commit
340278eca5
@ -47,6 +47,8 @@ if len(payload) == 0:
|
||||
print("No files to serve.")
|
||||
sys.exit(1)
|
||||
|
||||
payloadBytes = payload.encode("ascii")
|
||||
|
||||
if not directory == "":
|
||||
os.chdir(directory)
|
||||
|
||||
@ -66,11 +68,7 @@ try:
|
||||
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect((ip, 5000))
|
||||
|
||||
payloadBytes = payload.encode("ascii")
|
||||
|
||||
sock.sendall(struct.pack('!L', len(payloadBytes)) + payloadBytes)
|
||||
|
||||
while len(sock.recv(1)) < 1:
|
||||
time.sleep(0.05)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user