I just try to make a TCP Client which can connect a MySQL server for my IoT project.
When the TCP connection established between the esp8266 and the mysql server, the MySQL server send a payload data which contains some information about the mysql server.
Therefore, the receive callback function is called when the server responded and I send forward the payload through the uart0.
The server answer length is 78 bytes and the payload data:
But unfortunately the payload (char *pdata) contains only the first char in the reveice callback function which is actually the "J".
In addition the length value (unsigned short len) is 78 in the reveice callback function.
I have captured the communication with WireShark.
And the uart message:
I have tried to send other payloads with a tcp server application, it worked well and I have received the whole payload on the ESP , but in this case I get this issue everytime.
Has anyone ever met with this problem ? Any idea ?
my receive callback function:
LOCAL void ICACHE_FLASH_ATTR TCP_CallBack_Received(void *arg, char *pdata, unsigned short len)
ets_uart_printf("Received PAYLOAD :\n\r%s\n\r Length: %d\n\r",pdata,len);