|
From: | vincent cui |
Subject: | Re: [lwip-users] tcp_sndbuf return 0 when sending file |
Date: | Fri, 13 Apr 2012 04:58:18 +0000 |
Hi simon: I use following code to send file to server by FlashFxp static err_t ftpd_datarecv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
{ struct ftpd_datastate *fsd = arg; if (err == ERR_OK && p != NULL)
{ struct pbuf *q;
u16_t tot_len = 0;
for (q = p; q != NULL; q = q->next)
{
UINT len;
f_write(fsd->fil, q->payload, q->len, &len); tot_len += len;
if (len != q->len)
break;
}
tcp_recved(pcb, tot_len);
pbuf_free(p); ftpdatarecv_flag = 1;
} if (err == ERR_OK && p == NULL)
{ struct ftpd_msgstate *fsm;
struct tcp_pcb *msgpcb;
fsm = fsd->msgfs;
msgpcb = fsd->msgpcb;
f_close(fsd->fil);
fsd->fil = NULL;
ftpd_dataclose(pcb, fsd);
fsm->datapcb = NULL;
fsm->datafs = NULL;
fsm->state = FTPD_IDLE;
send_msg(msgpcb, fsm, msg226);
ftpdatarecv_flag = 0;
} return ERR_OK;
} After send a while , the tcp_recv(pcb, ftpd_datarecv); is trigged slowed, so the speed is down …. It seems LWIP1.3.2 bug .
Vincent Cui From:
lwip-users-bounces+address@hidden [mailto:lwip-users-bounces+address@hidden
On Behalf Of address@hidden 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.
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')! |
[Prev in Thread] | Current Thread | [Next in Thread] |