|
From: | Joel Cunningham |
Subject: | Re: [lwip-users] TCP send() fails when other sockets perform retransmissions |
Date: | Thu, 05 Jan 2017 09:43:33 -0600 |
RAW_PCB exhaustion is most likely unrelated to the problem you’re seeing. When TCP segments are allocated in tcp_write() (with TCP_WRITE_FLAG_COPY specified) there are two allocations: PBUF_RAM (coming from LwIP heap, controlled by MEM_SIZE) and struct tcp_seg (coming from MEMP_NUM_TCP_SEG static memory pool) In order to size these two pools according to what your connections can handle, you can use a worst case calculation where you assume all connections have a full send buffer worth of MSS segments. MEM_SIZE: should be at least MEMP_NUM_TCP_PCB * TCP_SND_BUF with some extra space for miscellaneous heap allocations MEMP_NUM_TCP_SEG: should be at least MEMP_NUM_TCP_PCB * (TCP_SND_BUF / TCP_MSS)
I haven’t used LWIP_SO_LINGER in my port, but when not enabled, you get the default TCP closure behavior which is a graceful close with a 20 second timeout (see LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT)
Joel |
[Prev in Thread] | Current Thread | [Next in Thread] |