2018-02-01 08:55 AM
Hello,
I am developing a client-server system using an STM32F407 CPU.The client is a VB.net software that sends some commands to the server, opening and closing a TCP socket for every commands.
To develop server firmware I'm modifing the 'TCP Echo Server' example based on Raw API.
The system works perfectly, provided that the data sent by the client (command and parameters) is a maximum of 12 bytes long; if the data is longer, it appears that the TCP connection is never really closed by the server.
Infact, if the number of the simultaneously active TCP connections (setted with the parameter MEMP_NUM_TCP_PCB in lwipopts.h) is five, by sending sequentially five commands the server answers yet, but if another commands is sent next, it goes down and I get the following messages from the LWIP logs:
memp_malloc: insufficient memory in the TCP_PCB pool
tcp_alloc: delete the oldest TIME-WAIT connectionmemp_malloc: insufficient memory in the TCP_PCB pooltcp_alloc: killing of the oldest LAST-ACK connectionmemp_malloc: insufficient memory in the TCP_PCB pooltcp_alloc: delete the oldest CLOSING connectionmemp_malloc: insufficient memory in the TCP_PCB pooltcp_alloc: killing of the connection with prio less than 64memp_malloc: insufficient memory in the TCP_PCB pooltcp_listen_input: unable to allocate PCBsThat seems to mean that the LWIP cannot create a new connection because the limit is reached.
I tried to change the other parameters in the lwipopts.h file, such as the heap memory size (MEM_SIZE) or the memp struct pbufs number (MEMP_NUM_PBUF), but I still get the same error.
Please, could you give me some suggestions to solve the problem?
Best Regards,
Tommaso
#tcp #lwipSolved! Go to Solution.
2018-02-08 12:46 AM
Hello,
I solved the problem by switching to LWIP 2.0.3, supported by the STM32CubeMX 4.24.
Best regards
Tommaso
2018-02-08 12:46 AM
Hello,
I solved the problem by switching to LWIP 2.0.3, supported by the STM32CubeMX 4.24.
Best regards
Tommaso