[bittorrent] Peer Wire Protocol and Messages

Brett Cooper bac15 at uakron.edu
Thu Apr 27 23:02:43 EDT 2006

In the wiki spec it explains about the peer wire protocol and messages,
but what is the ordering of the commands?  I believe you first do a
handshake, then a request, and then?  And are all these messages on a
single TCP connection or on many TCP connections?  Do you first send out
a handshake, close the socket, open a new socket for a request, send the
request, close the socket,  and continue on this way or maintain one
socket and send all messages then close the socket?  After a request or
another message, does the data come back on that same socket or on
another one that you might have running on port 6881?  An example of few
typical message sequences and interactions would be helpful.  Thanks for
the help.

More information about the BitTorrent mailing list