A pbuf can be a single one or a chain of them, and your app gets what the rx driver got, so most likely you can't tell in advance and have to be prepared to just deal with it. If you can spare the memory, you can copy to a buffer and be happy. But if you can't spare it, there are pbuf_ functions that provide some basic operations for typical actions on typical application work; like searching for a string. In a web server, for example, you need to parse the host headers, but they can come in several frames (due to TCP operation), and those frames may themselves be chains of pbufs (due to memory fragmentation). A common practice is to intentionally chain incoming pbufs until you get the expected length, and then parse the pbuf chain for the expected data. If memory is available, you might just copy everything to a big enough buffer.



_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to