uip的udp通信,需求定时往外发送数据。我用超时来处理,即
if(timer_expired(&periodic_timer))
{
//reset_clock_time();
timer_reset(&periodic_timer);
#if 1
for(i = 0; i < UIP_UDP_CONNS; i++)
{
uip_udp_periodic(i);
/* If the above function invocation resulted in data that
should be sent out on the network, the global variable
uip_len is set to a value > 0. */
if(uip_len > 0) {
uip_arp_out();
tapdev_send(uip_buf, uip_len);
}
}
然后在void udp_app_call()中 if( uip_poll() )//定时发送。