lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] tcp_sndbuf return 0 when sending file


From: address@hidden
Subject: Re: [lwip-users] tcp_sndbuf return 0 when sending file
Date: Thu, 12 Apr 2012 20:04:38 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

vincent cui wrote:

All

 

I develop a FTP server with lwIP 1.3.2 in Cortex M3 platform, when I use FlashFXP to get file from the server, the tcp_sndbuf always return 0 after work a while .

I capture it with wireshark, the file is attached file. The server ip: 192.168.1.51. it seems that transfer error and need retransmission.


From the wireshark capture, I cannot see why the segment is retransmitted. Also, at which point do you get tcp_sndbuf==0, and what's the size of tcp_sndbuf initially?

I'm afraid that doesn't really help on your problem, though :-(
If I were you, I'd first have a look at lwip_stats to see if there are dropped segments or memory (allocation) failures and then monitor the value of tcp_sndbuf() (maybe it keeps getting smaller and never grows again?).

My sendcode in server is below:

[..]

            err = tcp_write(pcb, fsd->fifo.buffer + i, (u16_t)(fsd->fifo.size - i), 1); 

Yikes! Using numbers instead of constants is really a thing people should learn (I'm speaking of TCP_WRITE_FLAG_COPY vs. '1')!

We provide the constants for people to use them so we are free to modify what they are defined to. By using '1' instead of TCP_WRITE_FLAG_COPY, you have successfully made your code susceptible to problems with future versions of lwIP (once we decide to change the value of TCP_WRITE_FLAG_COPY) :-)

Simon

reply via email to

[Prev in Thread] Current Thread [Next in Thread]