lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Large File transfer-- FTP lwIP 1.4.1


From: A480G
Subject: Re: [lwip-users] Large File transfer-- FTP lwIP 1.4.1
Date: Sun, 7 Aug 2016 06:20:11 -0700 (MST)

Hi Sergio,

Thank you for your advice, but you are mentioning that tcp_send as a call
back will need to be used in the main also tcp_poll.... ok. 

*void ftpd_init(void)  
{  
    struct tcp_pcb *pcb;  

    pcb = tcp_new();  
    tcp_bind(pcb, IP_ADDR_ANY, 21); 
        pcb = tcp_listen(pcb);
        tcp_accept(pcb, ftpd_msgaccept);        
}*

The only function that I call in the main is FTP_INIT..

in  ftp_msgaccept.. I call be other function ::

*static err_t ftpd_msgaccept(void *arg, struct tcp_pcb *pcb, err_t err)
{  
    fsm = mem_malloc(sizeof(struct ftpd_msgstate));  
    if (fsm == NULL) 
        {  
        PDU_DEBUGF(PDU_FTP_MSG_DEBUG, ("ftpd_msgaccept: Out of memory
\r\n"));  
        return ERR_MEM;  
    } 
 
    memset(fsm, 0, sizeof(struct ftpd_msgstate));  
    if (sfifo_init(&fsm->fifo, SFIFO_MAX_BUFFER_SIZE) < 0)
        {
                PDU_DEBUGF(PDU_FTP_MSG_DEBUG, ("ftpd msgaccept: Out of memory 
\r\n"));
                return ERR_MEM;
        } 
    fsm->state = FTPD_IDLE;   
  
    tcp_arg(pcb, fsm);  
   
    tcp_recv(pcb, ftpd_msgrecv);  
   
    tcp_sent(pcb, ftpd_msgsent);  

    tcp_err(pcb, ftpd_msgerr);  

    tcp_poll(pcb, ftpd_msgpoll, 1);  

    send_msg(pcb, fsm, msg220);  
  
    return ERR_OK;  
}*

My ftpd_msgpoll function call functions based on the command that was
asked...

*static err_t ftpd_msgpoll(void *arg, struct tcp_pcb *pcb)  
{  
        struct ftpd_msgstate *fsm = arg;  

        if (fsm == NULL) 
        {  
                return ERR_OK;   
        }

        if (fsm->datafs) 
        {  
                if (fsm->datafs->connected) 
                {  
                        switch (fsm->state) 
                        {   
                                case FTPD_LIST:   
                                        send_next_directory(fsm->datafs, 
fsm->datapcb, 0);   
                                        break;   
                                case FTPD_NLST:   
                                        send_next_directory(fsm->datafs, 
fsm->datapcb, 1);   
                                        break;   
                                case FTPD_RETR:   
                                        send_file(fsm->datafs, fsm->datapcb);   
-- Function that send the file 
                                        break;   
                                default:   
                                        break;   
                        }   
                }   
        }  
        if (cable_connect == 0 && datarecv_flag == 1)
        {
                ftpd_msgclose(pcb, fsm);
                /*
                if (fsm->listenpcb)
                {
                        tcp_close(fsm->listenpcb);  
                }
                */      
        }


        return ERR_OK;  
}  *

The only case that I'm interested in eventually case FTPD_RETR:
The problem that happens and i can't achieve a streaming packets is because
I GUESS the err_mem is return after my send_buffer is full. 
Can that be the problem and how I can deal with it.. 

Thanks 



--
View this message in context: 
http://lwip.100.n7.nabble.com/Large-File-transfer-FTP-lwIP-1-4-1-tp27025p27050.html
Sent from the lwip-users mailing list archive at Nabble.com.



reply via email to

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