Quecopen in BG95

Hi all.
I’m using Quecopen for the BG95. I started modifying the http example in order to send a post request. I was able to receive the sent information in the server.
Then, I add a loop in order to send many times information to the server, but the BG95 only do it once. So, would you like to help me please?
Here is part of my code:
void quec_http_client_thread(ULONG param)
{
//Above code equal than the original http example. Not shown for clarity
gas_porcent=60;
for(int cnt=0;cnt<5;cnt++)
{
result = http_download(host, port, file_name);
if(result < 0)
{
quectel_download_release();
continue;
}
while (1)
{
tx_event_flags_get(http_release_handle, RELEASE_FLAG | RE_DOWNLOAD_FLAG,
TX_OR_CLEAR, &session_pocess_sig, TX_WAIT_FOREVER);
HTTP_UART_DBG("@release_sig [0x%x]\n", session_pocess_sig);
if (session_pocess_sig & RELEASE_FLAG)
{
quectel_download_release();
//break;
}
else if (session_pocess_sig & RE_DOWNLOAD_FLAG)
{
// trigger next download process
HTTP_UART_DBG(“Re-download process again, current pos: %d, try - %d\n”,
http_session_policy.last_pos, http_session_policy.data_retry);
result = http_download_process(http_hadle, host, port, (char*)file_name);
if (result < 0)
{
quectel_download_release();
HTTP_UART_DBG(“Auf Wiedersehen”);
break;
}
}
}
gas_porcent++;
HTTP_UART_DBG(“gas_porcent: %d\n”, gas_porcent);
sprintf(valueB, “%d”, gas_porcent);
}
}

Where “http_download” and “http_download_process” functions are the follow:

static int http_download(char* host, uint16 port, uint8* file_name)
{
//Above code equal than the original http example. Not shown for clarity
qapi_Net_HTTPc_Set_Param(http_hadle, keyA, valueA);
qapi_Net_HTTPc_Set_Param(http_hadle, keyB, valueB);
qapi_Net_HTTPc_Set_Param(http_hadle, keyC, valueC);
qapi_Net_HTTPc_Set_Param(http_hadle, keyD, valueD);
ret = qapi_Net_HTTPc_Request(http_hadle, QAPI_NET_HTTP_CLIENT_POST_E, (char*)file_name);
if (ret != QAPI_OK)
{
HTTP_UART_DBG(“qapi_Net_HTTPc_Request ERROR :%d\n”,ret);
return -5;
}
return 0;
}

int http_download_process(qapi_Net_HTTPc_handle_t http_handler, char *host, uint16 port, char file)
{
//Above code equal than the original http example. Not shown for clarity
qapi_Net_HTTPc_Set_Param(http_handler, keyA, valueA);
qapi_Net_HTTPc_Set_Param(http_handler, keyB, valueB);
qapi_Net_HTTPc_Set_Param(http_handler, keyC, valueC);
qapi_Net_HTTPc_Set_Param(http_handler, keyD, valueD);
ret = qapi_Net_HTTPc_Request(http_handler, QAPI_NET_HTTP_CLIENT_POST_E, (char
)file);
if (ret != QAPI_OK)
{
HTTP_UART_DBG(“qapi_Net_HTTPc_Request ERROR :%d\n”,ret);
return -4;
}
return 0;
}
Trying to fix my problem, I found information about “qapi_Net_HTTPc_Set_Param”. The pdf document says:
“Multiple invocations of this function will result in appending the parameter key-value pair information to the internal data buffer”
Maybe this is causing the issue, so, how can I reset the internal buffers?
Or maybe I should not call “quectel_download_release”, but I’m not sure. Please help me.

Thanks in advance.

Any help?

Thank you in advance

Hi llich,

pls do not call quectel_download_release(), if you call this function , data call connection will be stop

, if you need to sending data again , There are no socket is available
image

image