BitTorrent Peer wire protocol (TCP)

How are messages encoded or sent / received by peers?

If there is a message

have: <len=0005><id=4><piece index> 

How is it sent (in binary, how is it converted to binary?) And received?

Is there a specific order in which messages are sent to peers?

I read the spec, but that leaves me with questions.

thank

+3
source share
2 answers

Before announcing the message, the have specification says:

< > < message ID > < > . . - . .

. " " - . , 5 1 ( ).

+3

.

, . , . BITFIELD , . PIECE , , , , .

. - , ( HAVE ). , . "", , PIECE 16 , , . , PIECE PIECE. , .

"", FAST. REQUEST PIECE REJECT-REQUEST. . REJECT-REQUEST -, , .

+3

Source: https://habr.com/ru/post/1773729/


All Articles