Does anyone have any idea what could be causing the issue.
Code: Select all
#define TCP_BUF_LEN 1024
void networkTask(void)
{
uint16_t receivebuf_len = 0;
char receivebuf[TCP_BUF_LEN] = {0};
char transmitbuf[TCP_BUF_LEN] = {0};
struct netconn* conn = globalScope.conn;
struct netbuf *inbuf;
err_t err = ERR_OK;
while(err == ERR_OK)
{
// read request
err = netconn_recv(conn, &inbuf);
if(err != ERR_OK)
{
ESP_LOGE(TAG, "error");
break;
}
receivebuf_len = netbuf_copy(inbuf, receivebuf, TCP_BUF_LEN);
processRequest(receivebuf, receivebuf_len);
// write response
processResponse(transmitbuf);
netconn_write(conn, transmitbuf, strlen(transmitbuf), NETCONN_COPY);
netbuf_free(inbuf);
netbuf_delete(inbuf);
vTaskDelay(10);
}
netconn_close(conn);
netconn_delete(conn);
}