tags : peer-to-peer, File Sharing, Network Programming, NAT

Semi-centralized peer-to-peer filesharing protocol where a “tit-for-tat” mechanism is used to reward good peers and to punish bad peers.

NAT traversal in bittorrent

Why do we need NAT traversal in bittorrent?

  • Read NAT
  • Usually one end of the 2 peers is public faced. So you don’t usually need to do anything extra if you’re behind NAT and you’re downloading.
  • If you’re uploading, you must a port open in the firewall which allows incoming packets. Because something has to “come-in” and let you know that it needs your data and then only you’ll upload.
  • Now how this incoming port is opened is the whole story of NAT traversal and is a topic on its own.
  • See this excellent answer on SO listing some NAT traversal techniques that can be possibly used in this case.

Discovery of peers

  • There is no single way to discover peers, often there will be multiple as fallback. These also need to be supported by individual clients, some clients may not have a DHT but may support other discovery stuff etc.
  • Some examples: Peer exchange, trackers, DHT, pre-listed peers etc.

Some extensions

Others

A .torrent file has info about all the metadata, the file pieces. From a magnet link, a client obtains the metadata from peers using DHT. The DHT swarm is different to peers of the torrent it seems and it’s specific to clients. How this DHT swarm works I need to explore more In the case of @internetarchive torrents, web seeds provide the files rather than the torrent peers. Sharing the magnet link won’t work cause the web seeds can’t provide you the metadata. I expected multiple torrent peers should work but apparently DHT swarm is entirely different f the DHT swarm is specific to clients, this makes the metadata peer discovery fragmented to the clients.

How many DHT swarms are there? How does it work, I need some time to explore this more. Ideally sharing just the magnet link should work anywhere in any client.

  • from sbin

IPFS vs Bittorrent

IPFS

See IPFS

Bittorrent

  • BitTorrent is a strong solution when you just need to get a file from point A to point B. It is a dumb system that is streamlined as much as possible for accomplishing that one goal. It’s a workhorse, a sledgehammer.
  • BitTorrent is also good for large files while IPFS is optimized for very small bits of data, and may have trouble gathering thousands of pieces of individual chunks that would go into any large file.

Tools

  • Open Port Check Tool : Can prove you’re connectable, cannot prove that you’re not connectable.

Learn more