All:

I use the latest LWIP 1.4.x from git.  And try to test lwIP receive speed by 
RAW api as following
I use tool send 2MB file, the speed is fast at first, but go to down after a 
while or transfer more times.
Anyone know the problem ?


static void close_conn(struct tcp_pcb *pcb)
{
      tcp_arg(pcb, NULL);
      tcp_sent(pcb, NULL);
      tcp_recv(pcb, NULL);
      tcp_close(pcb);
}

static err_t server_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t 
err)
{
      int len;

      if (err == ERR_OK && p != NULL) {
            tcp_recved(pcb, p->tot_len);
            len =p->tot_len;
            pbuf_free(p);
            tcp_sent(pcb, NULL); /* No need to call back */
      } else {
            pbuf_free(p);
      }

      if (err == ERR_OK && p == NULL) {
            close_conn(pcb);
      }
      return ERR_OK;
}


static err_t server_accept(void *arg, struct tcp_pcb *pcb, err_t err){
      LWIP_UNUSED_ARG(arg);
      LWIP_UNUSED_ARG(err);
      tcp_setprio(pcb, TCP_PRIO_MIN);
      tcp_recv(pcb, server_recv);
      tcp_err(pcb, NULL);
      tcp_poll(pcb, NULL, 4);
      return ERR_OK;
}

static void server_init(void)
{
    struct tcp_pcb *pcb;

    pcb = tcp_new();
    tcp_bind(pcb, IP_ADDR_ANY, 8081);
         pcb = tcp_listen(pcb);
         tcp_accept(pcb, server_accept);

         for (;;)
         {
                   vTaskDelay(50);
         }
}

void server_task(void *pvArg)
{
         dhcp_booting_wait();
        server_init();
}
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to