lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Telnet - Raw API


From: Sergio R. Caprile
Subject: Re: [lwip-users] Telnet - Raw API
Date: Fri, 10 Mar 2017 09:22:43 -0300
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Thunderbird/45.7.1

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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]