-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Hi,
Can you please suggest, how can i make an Asynchronous calls and POST data without any response.
I need to post the data every 2 seconds from my device to Server. At this moment, i don't want any acknowledgement, but rather just post the data.
Is there any way to achieve this?
I created my own method in the library as shown below, but its still taking 10 seconds.
int InetGSM::httpAsyncPOST(const char* server, int port, const char* path, const char* parameters, char* result, int resultlength)
{
boolean connected=false;
int n_of_at=0;
char itoaBuffer[8];
int num_char;
char end_c[2];
end_c[0]=0x1a;
end_c[1]='\0';
while(n_of_at<3) {
if(!connectTCP(server, port)) {
#ifdef DEBUG_ON
Serial.println("DB:NOT CONN");
#endif
n_of_at++;
} else {
connected=true;
n_of_at=3;
}
}
if(!connected) return 0;
gsm.SimpleWrite("POST ");
gsm.SimpleWrite(path);
gsm.SimpleWrite(" HTTP/1.1\r\nHost: ");
gsm.SimpleWrite(server);
gsm.SimpleWrite("\r\n");
gsm.SimpleWrite("User-Agent: Arduino\r\n");
gsm.SimpleWrite("Content-Type: application/x-www-form-urlencoded\r\n");
gsm.SimpleWrite("Content-Length: ");
itoa(strlen(parameters),itoaBuffer,10);
gsm.SimpleWrite(itoaBuffer);
gsm.SimpleWrite("\r\n\r\n");
gsm.SimpleWrite(parameters);
gsm.SimpleWrite("\r\n\r\n");
gsm.SimpleWrite(end_c);
return 1;
}
Can you please suggest more improvements ?
Also, is it mandatory to close the connection every time using AT+CIPCLOSE ?
Isn't there a way to make the connection open and send the packet to the server ?
You quick response will be highly appreciated !
Thanks
Metadata
Metadata
Assignees
Labels
No labels