Thanks. =)
> Question, how can I monitor current transfers being done?
> I would like to monitor the transfers that are happenning, so indeed,
> I would like to store the state of a transfer in a DB. I am able to do
> it when a transfer finishes by overriding the
> on_[incomplete_]file_received/sent methods, but how can I know when a
> transfer starts?
> Thanks again for your answers.
As of right now there are no such callback but it might be a good idea
to have them.
Right now you can do this in the AbstractedFS, by overriding open method:
class CustomFS(ftpserver.AbstractedFS):
def open(self, filename, mode):
fileobj = CustomFS.open(self, filename, mode)
if 'r' in mode:
# sending (server -> client)
send_callback(filename)
else:
# receiving (client -> server)
recv_callback(filename)
return fileobj
> --
> You received this message because you are subscribed to the "Python FTP server library" project group:
> http://code.google.com/p/pyftpdlib/
> To post to this group, send email to pyft...@googlegroups.com
> To unsubscribe from this group, send email to pyftpdlib-...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/pyftpdlib
You mean from the client perspective?
In that case the client can issue "STAT" command while the transfer is
in progress. The response will include the number of bytes
sent/received that far.
If you want to do this on the server side... well, DTPHandler class
stores that information into self.tot_bytes_sent and
self.tot_bytes_received attributes.
Those are updated in send() and handle_read() methods, every time a
chunk of data is sent/received.