Pergunta

I'm creating an FTP server in Qt, and I'm not sure when to send the 226 success response code for a RETR command.

Do I send it after all the data is written, but before the data connection socket is closed:

    reply(226);
    dataSocket()->disconnectFromHost();

or do I send it after the data connection socket is closed:

    dataSocket()->disconnectFromHost();
    dataSocket()->waitForDisconnected();
    reply(226);
Foi útil?

Solução

http://www.ietf.org/rfc/rfc959.txt

To prevent a race condition here, the server sends a reply (226) after closing the data connection.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top