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: vincent cui
Subject: Re: [lwip-users] tcp_sndbuf return 0 when sending file
Date: Thu, 12 Apr 2012 23:26:56 +0000

HI simon:

 

I found the tcp_sndbuff always return 0 because of   tcp_write fails. I think memory allocate fail, it works well after I remove #define MEMP_MEM_MALLOC               1 from lwipopt.h

        

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

  if (err != ERR_OK)

{  

      return;  

}

 

Does it make sense ?

Vincent Cui
Software Engineer Leader
Mobile: +8613255150315
Tel: +86 21 34612525x6104
Fax: +86 21 34619770
E-Mail: address@hidden
Shanghai EnLogic Electric Technology Co., Ltd.
Address: 1104-1106, Building A, No.391, Guiping Road, Xuhui District, Shanghai, 200233

 

 

From: lwip-users-bounces+address@hidden [mailto:lwip-users-bounces+address@hidden On Behalf Of address@hidden
Sent: 2012
413 2:05
To: Mailing list for lwIP users
Subject: Re: [lwip-users] tcp_sndbuf return 0 when sending file

 

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]