[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: FTP question
From: David Faure <david () mandrakesoft ! com>
Date: 2000-04-10 1:34:23
[Download RAW message or body]
Hi,
I need an FTP expert ;)
Short version: how to abort a download ('retr') ?
Long story:
I've been trying to implement Ftp::mimetype, i.e. downloading
the first 2048 bytes of a file and then aborting the transfer,
since 2K should be enough to determine the mimetype of a file.
The code is almost the same as Ftp::get but it doesn't loop around FtpRead.
It simply does it once
int n = ftpRead( buffer, 2048 );
array.setRawData(buffer, n);
data( array );
array.resetRawData(buffer, n);
and then tries to close the command (ftpCloseCommand, which closes
the data sockets). While this works, it seems it's enough to get
a message from the remote server.
So if we try to read the usual message that is sent after a command,
it fails. But if we _don't_ try to read it, it's not better. The next
command doesn't work either. In both cases, ftpReadLine() gives
"read failed", i.e. nothing to read.
Does anyone know a way to abort a FTP transfer ?
BTW, shutdown() is closed on the socket before close()... One
would think this is enough to make the data transfer abort, no ?
PS: other solution would be to store the data and use it for the Ftp::get
that most probably follows, i.e. not aborting the transfer.... Hmm...
--
David FAURE, david@mandrakesoft.com, faure@kde.org
http://home.clara.net/faure/
KDE, Making The Future of Computing Available Today
See http://www.kde.org/kde1-and-kde2.html for how to set up KDE 2
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic