Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 7 months ago.
Is the maximum number of sockets 4?
I'm running tests, and before I start digging through the source, I thought I'd ask if anyone already knows the answer to this question. I have some code that creates 10 sockets and then connects to each one, then sends data to each indefinitely. Only four sockets ever get created, so it seems that there's a hard limit there. Perhaps there's a #define in the EthernetInterface that I can twiddle...
I went digging a little through EthernetInterface, and the pertinent details seem to be in the lwIP library. In sockets.h, NUM_SOCKETS is #defined to MEMP_NUM_NETCONN. I changed this value from 4 to 5, and the result is that the 5th socket fails to be created. Or possibly what happened is that the library closed the previous socket and then opened a new one on the next port in my list. On my windows app, I get a "An existing connection was forcibly closed by the remote host", which is why I think socket #1 gets closed when socket #5 gets opened. There must be other settings I have to change to make this work, or perhaps 4 sockets is all that this hardware can handle (FRDM-K64F)...
posted by Dave M 18 Sep 2014I also found a "sanity check" for the number of connections, and decided to increase MEMP_NUM_TCP_PCB by one as well. Still doesn't work.
posted by Dave M 18 Sep 2014