lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Implementing Ftp File Transfert : Non blocking Send ?


From: Paul THILLOY
Subject: [lwip-users] Implementing Ftp File Transfert : Non blocking Send ?
Date: Wed, 31 Dec 2008 15:21:59 +0100

Hello to all,

I'm a beginner in lwip programmation....and I need some help....I hope I'm not asking something stupid...

I'm currently trying to implement a file exchange between a computer using Filezilla Server or whatever Ftp on the web and another device which is using Lwip.

I can connect, open a data connection, start the transfert, but if the connection to the server is lost...then I cannot escape from the write or send function...

This transfert part roughtly consists in :
(I erased the error checking steps)

the data socket is obtained through :
{
    struct sockaddr local;
    struct sockaddr_in *sa4;

    SockDataConnection = socket( ctrl_sock->sa_family, SOCK_STREAM, 0);

    memcpy(&local,ctrl_sock,
sizeof(struct sockaddr));

    sa4 = (struct sockaddr_in *) &local;
    sa4->sin_port = 0;
   
    bind(SockDataConnection,&local,local.sa_len);

    listen(SockDataConnection, 1);


    socklen_t addrlen = 0;

    nDataSock = accept(SockDataConnection,  NULL, &addrlen);

    do
    {
         readFile(fSrcFile,BufferSrc,&nNbRead);

        nNbWritten = write(nDataSock, BufferSrc, nNbRead); 
        // nNbWritten = send(nDataSock, BufferSrc, nNbRead,MSG_DONTWAIT);
    }
    while ((nCompt < FileLength) && (!ErrNo));
}

if the transfert is interrupted by some disconnection...then it is impossible to leave the send or write function...Am I doing something wrong ?

Thanks a lot for any help !

Best regards

Paul

reply via email to

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