Hi everybody,

I did some testing with the LwIP stack, and found the resulting LwIP stats  
inconsistent with
my assumptions. I'm hoping on of you is able to clarify things for me.

Here's the whats bodering me:

I've coded a TCP send callback function that's sends data to a TCP client. Each 
time a message from the client
is received (sort of ack callback function thus) the application sends some 
more data to the client, and increases a counter.
This counters is an indication of how many times the functions is 
executed/called. My assumptions was that when all of the data has been send,
the function counter is approximately the same as the LwIP received stats for 
TCP. However this isn't the case.

I assumed that when the callback function gets called (i.e. data is received) 
that the TCP received stat is increased by 1.
Therefore the func_cnt should be approximately the same als the TCP received 
stat. What am I missing here?

Thanks for the advice / help.


Below are the function and the resulting screen, the line that is made bold and 
italic is value of the func_cnt variable after all data is send.

err_t message_acked(void * arg, struct tcp_pcb * tpcb, u16_t len) {
       func_cnt++;  //increase the number of times the function is called
       16_t buff_space = tcp_sndbuf(tpcb); // check the available space in the 
output buffer 

        if(buff_space > bytes_left){    //the remaining data fits completely in 
the output buffer
            tcp_write(tpcb, pUSB_RAM, bytes_left, NULL);
        }
        else{ 
            tcp_write(tpcb, pUSB_RAM, buff_space, NULL);
        }
        return ERR_OK;
}



Modname:      Min:          Cur:       Max:       Cnt:                          
          
TCP_TMR:       100           100           649       1500                       
            
TMR_ISR:        121           198            211       1501                     
              
ARP_TMR:       530           572           609         750                      
             
TCP_INI:        9661          9661            0          1                      
             
1e_SEND:      6393           6393            0          1                       
            
ACK_RCV:    1885           3397        6317        702178                       
            
APP_IDL:  18249635   18249672  18249759    1501        
                          
xmited:  45878   rexmit:      0   recved:  57012   droped:      0              
errors:      0   chkerr:      0   pktfwd:      0   lenerr:      0              
memerr:      0   rterrs:      0   proErr:      0   opterr:      0 


      
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to