Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am bit confused about the PIECE size specification in BitTorrent protocol. To be specific, the torrent metainfo file, I am experimenting with, says that each piece should be 65536 bytes (except the last one which is (total_file_size - remaining bytes)). But the length of PIECE messages arriving is 16384 bytes, with the same number of pieces as specified by metainfo file. It happens with every torrent - PIECE size specified by metainfo file is different from the size of PIECE messages arriving. Am I missing something in the protocol ?

share|improve this question

migrated from stackoverflow.com Jun 7 '11 at 13:53

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

The PIECE message is used to transfer a part of a piece, which is commonly called a block. Most implementations seem to use a block size of 16K, which explains the behaviour you observed. The block size is set in each REQEUEST message.

For more information on this part of the BitTorrent protocol, I highly recommend this wiki page.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.