FAQ: Increasing the maximum number of sockets in lwIP in VisualDSP++.

Document created by CraigG on Nov 12, 2013Last modified by DavidS on Nov 12, 2013
Version 2Show Document
  • View in full screen mode


I cannot open more than 8 UDP sockets in lwIP. Is this a limitation of the lwIP stack; can it be modified?





The pre-built lwIP libraries provided in VisualDSP++ have a number of options that have been configured to default values that will be suitable for a wide number of applications, however there will be cases where they are not appropriate - such as requiring a greater number of UDP sockets.


Within VisualDSP++ we provide the full lwIP source code, together with projects for rebuilding the libraries. These can be found at "...\Blackfin\lib\src\lwip\contrib\ports\ADSP-Blackfin\proj\lwIPv4lib\".


Most lwIP options are configured through the "lwipopts.h" file, which can also be found in this directory, and we provide three different example configurations - lwipopts.h (default), lwipopts_big.h (provides increased memory to the lwIP stack), and lwipopts_small.h (which provides a smaller lwIP footprint). To use one of these other presets, simply change the name of the exsiting lwipopts.h file (e.g. to "lwipopts.h.bak"), and rename one of the other lwipopts_*.h files to "lwipopts.h". Alternatively, you can simply edit the lwipopts. file - though we would recommend making a backup of this file first.


These options can also be set via the TCP/IP Configuration Manager, available under the 'Tools' menu (if it is not available, you may need to enable the plugin under 'Settings: Preferences: Plugins'). The "TCP/UDP/ARP" tab offers options to configure the number of TCP connections, UDP connections, and number of sockets.


After editing any of these settings, rebuild the library. A post-build command will take care of copying the newly-built library into the "...\Blackfin\lib\" directory, so it will be linked by default for all lwIP applications. If you do not wish to overwrite the default library - for example, you may only want this configuration for one specific application - you can remove the Post-Build Option via 'Project: Project Options: Post-Buildbefore rebuilding the library.