When remote server replay to a request sent by Arduino, a getResponse function in Arduino loop can manage data sent from server.
This function store data in a fixed buffer : linebuff of LINEBUFFLEN size.
If data exceed are cut.
HTTP.getResponse(int socket)
socket : link socket
pointer to linebuff string
or NULL if no response is came
This function store data in a user buffer. So, it allows to receive more bytes expecially using function getNextResponseBuffer() in a loop until it returns 0.
HTTP.getResponse(int socket,byte rbuff,int rbufflen) //first response
HTTP.getNextResponseBuffer(int socket,byte rbuff,int rbufflen) //following reading
socket : link socket
rbuff: buffer to receive response
rbufflen: buffer length
number of bytes really read (if 0 no more bytes availlable)
HTTP.getResponseMessage() //returns HTTP code
nothing
HTTP code as null terminated string
#include <HTTPlib.h> //library include
HTTP WIFI; //instance of HTTP (inherits any stuff of MWiFi)
:
:
void loop{
:
:
char *line=getResponse(csocket);
if (line!=NULL) Serial.print(line):
:
}
or
int rsp=getResponse(csocket,buff,64);
while(rsp>0)
{
rsp=getNextResponseBuffer(csocket,buff,64);
:
}
:
}