参考uip-doc.txt
\subsection example4 Utilizing TCP Flow Control
This example shows a simple application that connects to a host, sends
an HTTP request for a file and downloads it to a slow device such a
disk drive. This shows how to use the flow control functions of uIP.
\code
void example4_init(void) {
u16_t ipaddr[2];
uip_ipaddr(ipaddr, 192,168,0,1);
uip_connect(ipaddr, HTONS(80));
}
void example4_app(void) {
if(uip_connected() || uip_rexmit()) {
uip_send("GET /file HTTP/1.0\r\nServer:192.186.0.1\r\n\r\n",
48);
return;
}
if(uip_newdata()) {
device_enqueue(uip_appdata, uip_datalen());
if(device_queue_full()) {
uip_stop();
}
}
if(uip_poll() && uip_stopped()) {
if(!device_queue_full()) {
uip_restart();
}
}
}
\endcode
fdsafs