On Sun, Jun 5, 2011 at 9:55 AM, Thiago Macieira <thi...@kde.org> wrote: > Em Sunday, 5 de June de 2011, às 13:06:07, tushar mehta escreveu: >> Hi all, >> >> I am currently trying to understand how kde applications uses kio >> for doing file related operations. I am currently working on kget and >> as part of my summer of code project task I need to figure out how >> we can have speed limit on transfer using kio protocols like http/ftp. >> >> Do have we have any sample examples or documentation related >> to KIO? > > I don't think there's any documentation on that. Just read the source code, > starting at KIO::Connection. > > But to simplify what you're looking for: kioslaves use blocking methods. They > read from the network one chunk of data and then they send that chunk of data > to the application (via KIO::Connection). The application also uses > KIO::Connection to read that chunk of data. > > When the ioslave fills up the kernel transfer buffer, KIO::Connection will > block, waiting for the application to read from the same buffer. > > In order to implement a rate control in the ioslave, you simply need to > implement a rate control in the application. After the stabilisation phase, > the ioslave will download at the same rate that the application reads from the > slave.
Might it be better to put it in KIO::Connection so it can be used more generally? For instance KNewStuff often exceeds the server thresholds, locking out the user for a while. Bandwidth limits could avoid this. It could also be useful if exposed to konqueror or rekonq plugins. -Todd >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<