mirror of https://github.com/ARMmbed/mbed-os.git
Fix tcp_hello_world test to receive all the data from http response
parent
70c0af19b9
commit
a22d968996
|
@ -76,7 +76,13 @@ void test_tcp_hello_world() {
|
||||||
sock.send(buffer, strlen(buffer));
|
sock.send(buffer, strlen(buffer));
|
||||||
|
|
||||||
// Server will respond with HTTP GET's success code
|
// 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';
|
buffer[ret] = '\0';
|
||||||
|
|
||||||
// Find 200 OK HTTP status in reply
|
// Find 200 OK HTTP status in reply
|
||||||
|
|
Loading…
Reference in New Issue