cancel
Showing results for 
Search instead for 
Did you mean: 

How to tune LwIP to receive more incoming connections?

DBurr
Senior

Hi, I've got FreeRTOS and LwIP running on an STM32F746. The application has a TCP socket listening for incoming connections. Incoming connections are coming from multiple sources and unfortunately I'm seeing some of the connections get an ECONNRESET error. I've tried turning up the number of TCP connections but this only seems to make the time between these ECONNRESETs greater and does not get rid of them completely. I'm wondering what other LwIP parameters I can tweak to help resolve this?

I was able to track down why the ECONNRESETs are happening. I've traced it to the "tcp_abandon" function getting called. The documentation indicates this function "Abandons a connection and optionally sends a RST to the remote host. Delete the local protocol control block. This is done when a connection is killed because of shortage of memory." I've tried tweaking the memory settings for LwIP but to no avail. Can anyone suggest settings to help with this?

Thanks,

Doug Burrell

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @DBurr​ ,

You can refer to the following link for lwIP internal memory pool management : http://www.nongnu.org/lwip/2_0_x/group__lwip__opts__memp.html.

By tweaking the options in lwipopts.h, it should be possible to receive more incoming connections: MEMP_NUM_TCP_PCB, MEMP_NUM_TCP_PCB_LISTEN, MEMP_NUM_NETCONN, etc...

Best regards,

Walid

View solution in original post

2 REPLIES 2

Hello @DBurr​ ,

You can refer to the following link for lwIP internal memory pool management : http://www.nongnu.org/lwip/2_0_x/group__lwip__opts__memp.html.

By tweaking the options in lwipopts.h, it should be possible to receive more incoming connections: MEMP_NUM_TCP_PCB, MEMP_NUM_TCP_PCB_LISTEN, MEMP_NUM_NETCONN, etc...

Best regards,

Walid

Thanks, Walid, I ended up increasing MEMP_NUM_NETCONN and this has solved my problem.

Regards,

Doug Burrell