[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] problem with creating TCP socket
From: |
Jan Menzel |
Subject: |
Re: [lwip-users] problem with creating TCP socket |
Date: |
Thu, 27 Nov 2014 11:58:03 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
Hi Gavin!
My code uses close() (which is a define to lwip_close()) which frees
all the memory. You may wont to trace close() to check if the memory is
really freed up.
Jan
On 27.11.2014 11:18, Gavin wrote:
> Hi,
>
> I got one problem about creating TCP socket.
>
> In my case, I created one TCP socket, connected to server and then closed
> socket, and repeated this process.
>
> But I found that this process only can run 4 times, because the socket can't
> be created from the 5th run, the socket can't be create anymore.
>
> In my understanding, based on my test case, the socket should be created in
> every run. Because I closed the socket at the end.
>
> I did some study on the forum, but I still can't fix this problem.
>
> BTW, I work on LwIP 1.4.1 with FreeRTOS on TM4C eval board.
>
> Does anyone have suggestion for me?
>
> Here is the lwipopt.h
> //*****************************************************************************
> //
> // ---------- Stellaris / lwIP Port Options ----------
> //
> //*****************************************************************************
> #define HOST_TMR_INTERVAL 100 // default is 0
> #define EMAC_PHY_CONFIG (EMAC_PHY_TYPE_INTERNAL | EMAC_PHY_INT_MDIX_EN |
> \
> EMAC_PHY_AN_100B_T_FULL_DUPLEX)
> #define PHY_PHYS_ADDR 0
> #define NUM_TX_DESCRIPTORS 24
> #define NUM_RX_DESCRIPTORS 8
>
> //*****************************************************************************
> //
> // ---------- Platform specific locking ----------
> //
> //*****************************************************************************
> #define SYS_LIGHTWEIGHT_PROT 1 // default is 0
> #define NO_SYS 0 // default is 0
> #if !NO_SYS
> #define LWIP_COMPAT_MUTEX 1
> #define RTOS_FREERTOS 1
> #define LWIP_PROVIDE_ERRNO 1
> #endif /* !NO_SYS */
>
>
> //*****************************************************************************
> //
> // ---------- Memory options ----------
> //
> //*****************************************************************************
> #define MEM_ALIGNMENT 4 // default is 1
> #define MEM_SIZE (64 * 1024) // default is 1600, was
> 16K
> #define MEM_USE_POOLS 1
> #define MEMP_USE_CUSTOM_POOLS 1
> #define MEM_USE_POOLS_TRY_BIGGER_POOL 1
> //*****************************************************************************
> //
> // ---------- Internal Memory Pool Sizes ----------
> //
> //*****************************************************************************
> #define MEMP_NUM_PBUF 64 // Default 16
> #define MEMP_NUM_UDP_PCB 8
> #define MEMP_NUM_TCP_PCB 8 // Default is 5
> #define MEMP_NUM_SYS_TIMEOUT 10
> #define MEMP_NUM_NETCONN 8
> #define PBUF_POOL_SIZE 64 // Default 16
>
> //*****************************************************************************
> //
> // ---------- IP options ----------
> //
> //*****************************************************************************
> #define IP_REASSEMBLY 0 // default is 1
> #define IP_FRAG 0 // default is 1
>
> //*****************************************************************************
> //
> // ---------- RAW options ----------
> //
> //*****************************************************************************
> #define LWIP_RAW 0
>
> //*****************************************************************************
> //
> // ---------- DHCP options ----------
> //
> //*****************************************************************************
> #define LWIP_DHCP 1 // default is 0
>
> //*****************************************************************************
> //
> // ---------- UDP options ----------
> //
> //*****************************************************************************
> #define LWIP_UDP 1
>
> //*****************************************************************************
> //
> // ---------- TCP options ----------
> //
> //*****************************************************************************
> #define LWIP_TCP 1
> #define TCP_WND 2048 // default is 2048
> #define TCP_MSS 256 // default is 128
> #define TCP_SND_BUF (4 * TCP_MSS)
> #define TCP_SND_QUEUELEN (4 * (TCP_SND_BUF/TCP_MSS))
>
> //*****************************************************************************
> //
> // ---------- Pbuf options ----------
> //
> //*****************************************************************************
> #define PBUF_LINK_HLEN 16 // default is 14
> #define PBUF_POOL_BUFSIZE 1024
> // default is
> LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN)
> #define ETH_PAD_SIZE 0 // default is 0
>
> //*****************************************************************************
> //
> // ---------- Thread options ----------
> //
> //*****************************************************************************
> #define TCPIP_THREAD_NAME "tcpip_thread"
> #define TCPIP_THREAD_STACKSIZE 1024
> #define TCPIP_THREAD_PRIO 3
> #define TCPIP_MBOX_SIZE 32
>
> //*****************************************************************************
> //
> // ---------- Sequential layer options ----------
> //
> //*****************************************************************************
> #define LWIP_NETCONN 1 // default is 1
>
> //*****************************************************************************
> //
> // ---------- Socket Options ----------
> //
> //*****************************************************************************
> #define LWIP_SOCKET 1 // default is 1
> #define LWIP_COMPAT_SOCKETS 1
>
>
>
>
> --
> View this message in context:
> http://lwip.100.n7.nabble.com/problem-with-creating-TCP-socket-tp23553.html
> Sent from the lwip-users mailing list archive at Nabble.com.
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>