practice/python/SocketPractice/utility.py

15 lines
398 B
Python

def wait_for_acknowledge(client, response):
"""
Waiting for this response to be sent from the other party
"""
amount_received = 0
amount_expected = len(response)
msg = str()
while amount_received < amount_expected:
data = client.recv(16)
amount_received += len(data)
msg += data.decode("utf-8")
# print(msg)
return msg