Hello,
I am creating a simple socket server on the ESP32 using the esp-idf libraries on Eclipse.
When the schedular starts the connection task, it results in this error message:
[0;32mI (81) cpu_start: Starting scheduler on APP CPU..[0m.socket: -1 error: No buffer space available
The error message is coming from my code as follows:
void socket_server_task(void *ignore) {
#define PORT_NUMBER 8001
struct sockaddr_in clientAddress;
struct sockaddr_in serverAddress;
int sock;
int rc;
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (sock < 0) {
printf("socket: %d ", sock);
printf("error: %s ", strerror(errno));
vTaskDelete(NULL);
}
This task is started from my main app as follows:
void app_main() {
nvs_flash_init();
xTaskCreate(&socket_server_task, "socket_server_task", 2048, NULL, 5, NULL);
xTaskCreate(&main_task, "main_task", 2048, NULL, 5, NULL);
}
I looked at my menuconfig and nothing seems to be out of the ordinary - see relevant sdkconfig settings below:
# ESP32-specific
#
CONFIG_WIFI_ENABLED=y
CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10
CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=5
CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32
CONFIG_ESP32_WIFI_AMPDU_ENABLED=y
CONFIG_ESP32_WIFI_NVS_ENABLED=y
CONFIG_PHY_ENABLED=y
# LWIP
#
CONFIG_L2_TO_L3_COPY=y
CONFIG_LWIP_MAX_SOCKETS=10
CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX=0
CONFIG_LWIP_SO_REUSE=y
CONFIG_LWIP_SO_RCVBUF=y
CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1
# CONFIG_LWIP_IP_FRAG is not set
# CONFIG_LWIP_IP_REASSEMBLY is not set
CONFIG_TCP_MAXRTX=12
CONFIG_TCP_SYNMAXRTX=6
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
What am I missing that is causing this error at bootup time?
socket server buffer error
Re: socket server buffer error
Where are you initing the tcpip adapter and WiFi?
Re: socket server buffer error
I was beginning to suspect that I was missing that part. However, I was following this tutorial from Kolban (see below) and his example seemed to work without it. Perhaps he did not mention it out of brevity. Either way, the generated error message is very misleading if that is the issue.
I'll try adding in the tcpip init and see if that works.
https://www.youtube.com/watch?v=KyCZh9N ... poUUE7QMOo
I'll try adding in the tcpip init and see if that works.
https://www.youtube.com/watch?v=KyCZh9N ... poUUE7QMOo
Re: socket server buffer error
Thank you WiFive! That did the trick. I added a call to a tcpip_adaptor function that configured, started and connected the WiFi and the socket connection started up with no problem.
Much appreciated.
posting.php?mode=reply&f=13&t=1689#
Much appreciated.
posting.php?mode=reply&f=13&t=1689#
Who is online
Users browsing this forum: No registered users and 165 guests