Closed mapa17 closed 12 years ago
Implemented a torrent class that can be parameterized in the size of the torrent ( bytes ).
Block size and the number of pieces per torrent is fixed. Hence the number of blocks per piece is calculated depending on the torrent size.
blockSize = 512 bytes nPieces = 500
e.g. nBlocksPerPiece = (TorrentSize/nPieces) / blockSize
A dictionary is keeping track of the pieces downloaded and finished. Helper methods can be called to receive a subset of the piece set containing either only the finished, the downloading or the empty pieces.
Create a torrent class which describes different torrent properties like
Torrent size ( bytes ) Block size ( bytes ) Piece size (bytes )
And a binary bitmap of pieces