MEM_UDP_PCB usage vs MEM_TCP_PCB usage

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

MEM_UDP_PCB usage vs MEM_TCP_PCB usage

stuart200471
Hello,
    I am currently running both a TCP and a UDP server on an STM32 chip. The
server takes in txt commands and sends out txt results.
With the TCP server, I have set MEM_TCP_PCB = 10, this allows me to have 10
simultaenous TCP connections to the server. If i try to have more, the lwip
stats show errors in the MEM_TCP_PCB values.

Now, with the UDP server, I thought i would need the same... e.g.
MEM_UDP_PCB = 10. But, through experimenting, it appears that I only need to
allocate 1 UDP_PCB for the UDP server. When the UDP packet arrives, it gets
the allocated UDP_PCB, it gets sent to the udp_serv_recv() function to get
processed. After processing, a response is immediately sent back to the
client (through lwip) using the same udp_pcb.
To test this, i created an app which had 128 individual clients all sending
requests to the server (and being responded too) and when looking at the
lwip stats, my MEM_UDP_PCB "used" value never increased and the lwip heap
stayed within limits.
Now, i am (happy) surprised that this appears to be the case...but just to
make sure, I thought i would run it past you all incase your experience is
wildly different to mine.
So, is this the behaviour (resource usage) you would expect for the UDP
server? or, would you say I am measuring some thing incorrectly?
Thanks
Stuart



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users