cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Server receives proper data but shows incorrect received data length in STM32F439

Gaurali Mehta
Associate

Hi, I am using STM32F439 as TCP Server with LWIP TCPecho example. 

I am properly receiving data of any length from TCP Client, and I am also able to send back the received data to TCP Client without any issues. However, if the received data length is more than 536 bits, the data length pointer will always indicate 536 as the length received.

Data Pointer: es-> p-> payload

Data Length Pointer: es-> p-> len

I am not able to get to the problem as why this is happening and I need the accurate length to send the data to other microcontroller via SPI.

It will of a great help if anyone could help me to solve this problem.

I am also attaching my tcpserverecho.c file for the reference.

Thank You.

2 REPLIES 2
RhSilicon
Lead

I'm not sure if this solves your problem, but check if it helps:

Generally, the packet size gets restricted by the Maximum Transmission Unit (MTU) of network resources. MTU is the maximum size of the data transfer limit set by hardware in a network. The packet size should never exceed MTU

https://www.baeldung.com/cs/tcp-max-packet-size

LCE
Principal

I think 536 is the default MTU for lwIP, which you can increase in the lwip_opt.h file up to 1500.

Further, make sure that your RX buffers are big enough.