I'm using lwIP, raw mode, in a project which plays Internet streaming audio. When my audio ring buffer becomes full, I must momentarily halt incoming packets. Previously I was using uIP, and I could simply call uip_stop and uip_restart. That worked great but uIP had other problems with the data stream which I'm hoping lwIP can solve.
As I understand, in the recieve callback I would call tcp_recved() and pbuf_free() to tell lwIP that I have the data and it can clear it from its buffer. How do I tell lwIP that I can't accept more data now, and it should send ZeroWindows? I have tried not calling these functions in different combinations, and the host (what lwIP is connecting to) keeps retransmitting because lwIP apparently didn't ACK.
However, I noticed if I set tcp_recv(pcb, 0) rather than the correct callback
function, it will send ZeroWindows.
Do I have to keep track of the pointer to the pbuf in my code to use later (if my buffer is full), and when should I call tcp_recved() when I can't currently accept more data? What is the correct usage to ensure lwIP sends ZeroWindows rather than not ACKing?
|