practice/python/SocketPractice/utility.py

15 lines
398 B
Python
Raw Normal View History

2022-01-19 16:32:57 +01:00
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