|Subject:||Re: [lwip-users] Confused about flow control|
|Date:||Mon, 27 Jul 2009 06:39:40 -0700 (PDT)|
|Thanks for the reply Kieran. From my perspective, of course it doesn't matter to me if lwIP continues to receive data provided there's space in the receive window. I'm just trying to figure out the best way to handle the situation when my application's buffer is full. I've been having trouble getting things to work, but this could be because of errors in my implementation rather than my lack of understanding of lwIP.|
I'm using raw API, and I'm doing streaming audio, so after I initiate the connection, the application doesn't have to transmit anything else; it just receives. So with that, here's what I think I need to do in the callback defined in tcp_recv(). Please correct me if I'm wrong:
-If I have space in my buffer, I take the data, then call tcp_recved() and pbuf_free().
-If there currently is not enough space in my buffer, I store the pbuf pointer for later. I haven't tried this yet, but should I also call tcp_recved() with len=0?
-I periodically check if there's space in my buffer. When there is, I retrieve the data from the pbuf pointer I stored. Then I call tcp_recved() and pbuf_free().
I had planned on using tcp_poll() to do the periodic buffer checking, but it's a little slow (500ms). Is it Ok if I instead do this in the ethernet/periodic interrupt before lwIP runs?
|[Prev in Thread]||Current Thread||[Next in Thread]|