I am Using Python socket lib, i want to receive the entire data coming from server i have tried using loops but it stucking after reading the data.
def readReply(self):
recv_data = b''
while True:
data = self.client_socket.recv(1024)
if data:
recv_data += data
else:
break
return recv_data
recv_data, but then you return a different variable namedbuffer.self.client_socket.recv(1024)? If the socket is in blocking mode and no data is received, this function will block the thread forever. Setting a timeout before receiving any data and using atry-exceptblock to catch the timeout exception should be the way to go.