Giuseppe Modugno wrote: [..] > >> What are the situations when it should be better to not call > >> tcp_recved() in recv() callback()? Here the application has the > >> received data, can process and free the pbufs or can avoid freeing > >> the pbufs to wait for additional data. In both cases I think the > >> application should call tcp_recved(). > > > > If you need to process the received data further at slower speed, it's > > better to not call tcp_recved() right away. For example if you're > > programming into slow flash, calling tcp_recved after the bytes are > > programmed ensures the client does not send faster than you can program. > > In this case you don't free the pbuf, because data is being written to > the Flash. So it seems to me that when you free the pbuf (you have > processed the incoming data), you can call tcp_recved(). If you don't > free the pbuf, you haven't processed the data yet, so you don't call > tcp_recved(). > > I don't understand when the two things can be different.
They might be the same for you. But if you have a different buffering scheme (e.g. a ring buffer for flash writes or whatever), it could be different. With a library like lwIP, you just don't know how it will be used in the actual targets. Regards, Simon _______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users