5 years, 5 months ago.

is there a limitation of 3 sockets ?

Hi there,

I have a project that needs to run 4 UDP sockets - whatever I try, the 4th socket fails on the call. I'm using the NetworkAPI and the sockets are declared as

network::udp::socket socket;

The project also uses rtos and threads and each socket has its own thread, can anyone help ? thanks, Matthias

Comment on this question

1 Answer

5 years, 5 months ago.

I'm getting closer: the problem's cause seems to be a memory issue. The compiler reports a RAM consumption of 119%, but I read in other articles that this information is not necessarily correct.

So I checked the returned values when the lwip_socket() attempts to create a new connection, 0. conn = 0x20080924 1. conn = 0x20080878 2. conn = 0x200807cc 3. conn = 0

Each connection is allocated in (sockets.c) in netconn_new_with_callback() - I don't understand why the address keeps decreasing. I would assume this is heap memory, so the address would increase ?

Also, this shows that each each connection uses 172 bytes, ok, but with respect to these numbers, there is still some memory available...

Since I don't need any TCP, I set "LWIP_TCP" to 0, in order to save memory - this has no visible effect. Any ideas how to reduce the memory consumption..?

thanks, matthias

To post an answer, please log in.