Fix tcp_hello_world test to receive all the data from http response

pull/5954/head
Senthil Ramakrishnan 2018-01-08 14:14:01 -06:00 committed by Cruz Monrreal II‰
parent 70c0af19b9
commit a22d968996
1 changed files with 8 additions and 2 deletions

View File

@ -76,7 +76,13 @@ void test_tcp_hello_world() {
sock.send(buffer, strlen(buffer));
// Server will respond with HTTP GET's success code
const int ret = sock.recv(buffer, sizeof(buffer) - 1);
int ret = 0;
int bytes_recvd = 0;
do {
ret += bytes_recvd;
bytes_recvd = sock.recv(buffer+ret, sizeof(buffer) - 1 - ret);
}while(bytes_recvd > 0);
buffer[ret] = '\0';
// Find 200 OK HTTP status in reply