[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Pbuf chain
From: |
Mike He |
Subject: |
[lwip-users] Pbuf chain |
Date: |
Thu, 29 May 2014 19:41:40 -0700 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
If my understanding is correct, the pbuf that is passed to our recv
callback is only the first in a chain, where we must traverse the chain
to obtain the full packet?
I am confused by this line in the documentation:
"The last pbuf of a packet has a ->tot_len field that equals the ->len
field. It can be found by traversing the list. If the last pbuf of a
packet has a ->next field other than NULL, more packets are on the queue.
Therefore, looping through a pbuf of a single packet, has an loop end
condition (tot_len == p->len), NOT (next == NULL)."
Why would there be two conditions? Is ever one true when the other
isn't? How do the lengths add up if the first condition is true but the
second isn't?
Does anyone have example code for how to obtain the full packet?
Thanks,
Mike
- [lwip-users] Pbuf chain,
Mike He <=