osa1
osa1

Reputation: 7088

parsing BEP9(ut_metadata) data message

BEP9(ut_metadata) data message has a total_size field and I'm having trouble seeing what it means.

The message is in this format:

<4-byte length prefix><20><1-byte extended msg id><bencode part><piece data>

I'm confused about two things:

  1. Does length-prefix include <piece data> part?
  2. What does total_size field in bencode_part specify?

It looks to me like we don't need total_size, unless I'm misunderstanding something.

Here is currently how I'm parsing it:

Can anyone help me understanding this format?

Thanks.

Upvotes: 0

Views: 348

Answers (1)

the8472
the8472

Reputation: 43125

  1. yes
  2. the total length of the info section of the .torrent file. The metadata may be transferred in multiple chunks if they are too big for a single message.

Upvotes: 1

Related Questions