Wednesday, November 9, 2016

ESP32 - How to increase the maximum number of sockets

Still didn't found an ESP32 with a decent delivery price so today I've tested the environment provided by EspressIf looking on the maximum number of sockets. On ESP8266 I've managed to have more then 20 sockets opened and carrying MQTT packets ( see https://myesp8266.blogspot.co.uk/2016/11/mqtt-broker-on-esp8266-5.html)

I've noticed that the maximum number of sockets that you can setup from make menuconfig is 16. 

All the values that you are setting from make menuconfig are ending in a file named sdkconfig in the root of you app directory. This sdkconfig file will be converted to sdkconfig.h located in app/build/include/sdkconfig.h.

Even you are modifying a value direct in the sdkconfig on the compile time you will be invited to enter a value 1..16 for maximum number of sockets.

Solution #1. (Safest one)

Change the sdkconfig.h file overwrite the desired value and recompile

#define CONFIG_LWIP_MAX_SOCKETS 20

Solution #2. (not recommended but possible )

Modify directly the file:

esp-idf/components/lwip/include/lwip/port/lwipopts.h
#define MEMP_NUM_NETCONN          20 //CONFIG_LWIP_MAX_SOCKETS


If you modified values in make menuconfig and you don't know what was before don't worry just do a diff between the app/sdkconfig and app/sdkconfig.old file.


Obs: this post can be found also on this link.



No comments:

Post a Comment