简体   繁体   中英

Bittorent protocol. Multiple downloads between same peers

I'am just started to studying bittorent protocol and have one question about bittorrent clients that uses same ports for all incoming connections.

Here is example of my problem:

1st connection: A local peer listening on 1.0.0.1:1 and receives connection from remote peer with address 2.0.0.2:2 . OK. Start PWP

2nd connection: A local peer listening on 1.0.0.1:1 and receives connection from remote peer with address 3.0.0.3:2 . OK. Start PWP

3rd connection: A local peer listening on 1.0.0.1:1 and receives connection from remote peer with address 2.0.0.2:2 but with another InfoHash. ???

Is 3rd connection possible or remote peer( 2.0.0.2:2 ) have to track it's connections to local peer( 1.0.0.1:1 ) and will connect to local peer through different port and also announce himself 2nd time to tracker with different port or/and peer id?

Yes, it is possible for two peers to use more than one connection, sharing torrents with different InfoHashes at the same time. There are two different cases depending on what type of transport protocol the connection is done over.

TCP connection

When a bittorrent peer shares over TCP, it opens up a incoming port that is announced to the tracker(s) and that port is the one used to connect to by every other peer that initiates a connection to that peer. However, a peer that initiates and makes a outgoing connections uses a different port number for every outgoing connection.
That makes it possible to uniquely identify every connection by its (IP:PORT<->IP:PORT) -pair.

uTP/UDP connection

When a peer shares over uTP/UDP it uses the same port for both incoming and outgoing connections. To make it possible to differentiate between the connections, the uTP protocol extension instead uses a connection_id that is unique for every connection.
The advantage with using the same port for both incoming and outgoing connections is that it makes UDP hole punching possible.


The peer makes a separate announce to the tracker(s) for every different InfoHash .
All modern clients reuses the same incoming port for all torrents it shares.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM