You can chat about native SDK questions and issues here.
User avatar
By nthd
#59680 Hi,

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:
Code: Select allJ
5.7.14nl0^0ee!>LSS=imysql_native_password


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.
Image

And the uart message:
Image

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 ?

Thank you.


my receive callback function:

Code: Select allLOCAL void ICACHE_FLASH_ATTR TCP_CallBack_Received(void *arg, char *pdata, unsigned short len)
{
   #ifdef TCP_DEBUG
      ets_uart_printf("Received PAYLOAD :\n\r%s\n\r Length: %d\n\r",pdata,len);
   #endif
}
Last edited by nthd on Mon Dec 19, 2016 5:38 pm, edited 1 time in total.
User avatar
By nthd
#59714
Pablo2048 wrote:It seems like you are using printf function with %s so print stop at first 0x00 character (just right after 'J' one) :-)


Thank you! You are right!

I just tried to fix this problem throughout last night and I did not noticed, it was my fault :oops:
Thanks a lot! :)