lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] tcp_sndbuf return 0 when sending file


From: vincent cui
Subject: [lwip-users] tcp_sndbuf return 0 when sending file
Date: Thu, 12 Apr 2012 07:09:48 +0000

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.

 

Untitled.png

 

My sendcode in server is below:

 

static void send_data(struct tcp_pcb *pcb, struct ftpd_datastate *fsd) 

    err_t err; 

    u16_t len; 

    int i;

    if (sfifo_used(&fsd->fifo) > 0)

         {  

        if (tcp_sndbuf(pcb) < sfifo_used(&fsd->fifo))

                   {  

            len = tcp_sndbuf(pcb);   -> the len is set 0 after work a while.

        }

                   else

                   {  

            len = (u16_t)sfifo_used(&fsd->fifo);  

        }

        

        i = fsd->fifo.readpos;  

        if ((i + len) > fsd->fifo.size)

                   { 

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

            if (err != ERR_OK)

                            {  

                return;  

            }  

            len -= fsd->fifo.size - i;  

            fsd->fifo.readpos = 0;  

            i = 0; 

        }

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

        if (err != ERR_OK)

                   {  

             return;  

        }  

         fsd->fifo.readpos += len;

    }         

 

Who know how to solve ?

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

 

 

Attachment: sendfileerror.pcap
Description: sendfileerror.pcap


reply via email to

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