GetZBlock

From DCppWiki

Jump to: navigation, search

Name: GetZBlock

Context: Client, Hub

Supported By: DC++ 0.307+

Description

Instead of $Get and $Send, use "$GetZBlock <start> <numbytes> <filename>|" where <start> is the 0-based (yes, 0-based, not like $Get that is 1-based) starting index of the file used, <numbytes> is the number of bytes to send and <filename> obviously is the filename. The other client then responds "$Sending <bytes>|<compressed data>", if the sending is ok or "$Failed <errordescription>|" if it is not. If everything is ok, the data is sent until the whole uncompressed length has been sent. <bytes> specifies how many uncompressed bytes will be sent, not compressed, as the sending client doesn't know how well the file will compress. $Sending is needed to be able to distinguish the failure command from file data. Only one roundtrip is done for each block though, minimizing the need for maintaining states.

Compression

Compression is done using ZLib (v 1.2.2 in DC++ 0.667 onwards), using dynamic compression level. The compression level can of course be changed by the implementor to reduce CPU usage, or even just store compression in the case of non-compressible files, which then works as adler32 check of the transferred data.