# Stuck on stage 12 bittorrent

**URL:** <https://forum.codecrafters.io/t/stuck-on-stage-12-bittorrent/2936>\
**Category:** Challenges\
**Tags:** challenge:bittorrent\
**Created:** [November 14, 2024, 1:37pm UTC](https://forum.codecrafters.io/t/stuck-on-stage-12-bittorrent/2936 "2024-11-14T13:37:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JavaIsNotHard](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/javaisnothard/32/2549_2.png) [@JavaIsNotHard](https://forum.codecrafters.io/u/JavaIsNotHard)\
**Post date:** [November 14, 2024, 1:37pm UTC](https://forum.codecrafters.io/t/stuck-on-stage-12-bittorrent/2936/1 "2024-11-14T13:37:15Z")

</div>

The instruction says to break the piece into blocks of 16KB and send the blocks in each request message  
I don’t quite understand what piece refers to here. It is the hash value or something else?

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [November 14, 2024, 2:21pm UTC](https://forum.codecrafters.io/t/stuck-on-stage-12-bittorrent/2936/2 "2024-11-14T14:21:00Z")

</div>

Hi @JavaIsNotHard, the file you want to download is divided into pieces, which in turn are divided into blocks—so each piece represents **a part of the file**.

Each piece is identified by an index. Our tester will specify which piece it wants your program to download:

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/b/b95b2383845026963b27dc404640190a8932d5a8.png)

Remember that your code already knows the `piece length`. For example, if the piece length is 160KB, your code will need to request 10 blocks to download the entire piece.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/6/6e17f49f56f48d2acd5e54fd4f1c194e73b30b5d.png)

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [November 23, 2024, 2:33pm UTC](https://forum.codecrafters.io/t/stuck-on-stage-12-bittorrent/2936/3 "2024-11-23T14:33:57Z")

</div>

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [November 28, 2024, 2:34pm UTC](https://forum.codecrafters.io/t/stuck-on-stage-12-bittorrent/2936/4 "2024-11-28T14:34:52Z")

</div>

Closed on November 28, 2024, 2:34pm UTC

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
