The code I posted above does not matter how many packets the response is sent in. It could be one packet with a thousand characters, or a thousand packets with one character. It waits for the server to close the connection. That is why the "while(client.connected())" loop.