|Subject:||Re: Server-Side FTP Upload Resume|
|Posted by:||Remy Lebeau (TeamB) (gambit…@yahoo.com)|
|Date:||Thu, 17 Jul 2003|
"virtek" <virte…@hotmail.com> wrote in message
> OnRetrieveFile server event will be fired and the VStream
> parameter will be linked to an opened TFileStream and the
> upload will start smoothly.
OnRetreiveFile is for downloading, not uploading. For uploading a file from
the client to the server, use the OnStoreFile event instead.
> But what will happen if the client wants to resume an existing
> download ? the client shouldn't have a problem do it using
> TIdFTP Get() procedure with AResume boolean set to true.
> But How TIdFTPServer will respond to that ?
TIdFTPServer already handles that for you. The responsibility of the
OnRetreiveFile event is just to create the necessary TStream, nothing else.
Once control is passed back into the TIdFTPServer after the event handler
returns, the TIdFTPServer will seek the stream to the requested position as
appropriate before then transferring the stream to the client.
> How do I tell TIdFTPServer to resume upload (and
> how it knows when there is one to resume) ?
It knows everything it needs to know when it parses the commands from the
client long before the cooresponding events are triggered. It is the
client's responsibility to provide the information about the resume. To
resume a download, the client has to send a REST command before then sending
a RETR command. To resume an upload, the client has to send a APPE command
rather than a STOU or STOR command. In all cases, the server knows exactly
what the client is trying to do based on the command and parameters that are
sent to it, so it can act accordingly.
Server-Side FTP Upload Resume posted by virtek on Thu, 17 Jul 2003