connection - How do torrent clients like Utorrent work behind the scenes?

07
2014-07
  • user3586062

    I am looking to write my own small scale torrent client, similar to Utorrent. However I am unsure of how to even begin to establish a connection to the different seeders. Once I have a torrent file containing all of the data how can I decode it and interpret it?

    What is the protocol to establish a connection to the trackers? Assuming my knowledge and terminology is correct once I connect to the trackers found within the torrent file, I will then receive a list of some sort containing the seeders IP and Ports. Then can I connect and begin to download pieces of the file from the seeders.

    Also I know that Utorrent lists current seeders IP and I think their port as well. Once I know a seeders IP and port is it possible to manually establish a connection and start downloading the file pieces? Or is there a handshake or layer of security that prevents that?

  • Answers
  • ultrasawblade

    The Bittorrent protocol is detailed here. You can also study the source code of an open-source Bittorrent application such as Transmission.

    What is the protocol to establish a connection to the trackers?

    HTTP.

    Once I know a seeders IP and port is it possible to manually establish a connection and start downloading the file pieces? Or is there a handshake or layer of security that prevents that?

    If the peer hasn't choked you due to you being stingy or unreliable. There's probably more to it, I haven't read the full spec in a long time. Read the spec.

    As far as access-level security, there is none beyond that choking mechanism, which isn't really a security measure but just a fairness enforcement measure. I'm not entirely sure how encryption works but it's only to protect the transport and not to serve to identify the peer. As far as making sure that the pieces peers give out are parts of the torrent, that's what the SHA-1 hashes are for.


  • Related Question

    What is uTorrent? How is it different from BitTorrent?
  • The Green Frog

    What is uTorrent and how is it different from BitTorrent? What is it used for? Where is a tutorial? What is BitTorrent?


  • Related Answers
  • David Pearce

    µTorrent is just a different client for the Bittorrent protocol. µTorrent would have to be one of the most 'respected' and popular BitTorrent clients for Windows.

    According to Wikipedia, BitTorrent is:

    A peer-to-peer file sharing protocol used for distributing large amounts of data. BitTorrent is one of the most common protocols for transferring large files. BitTorrent protocol allows users to receive large amounts of data without putting the level of strain on their computers that would be needed for standard Internet hosting

    Now this is where it starts getting a bit confusing. BitTorrent is:

    The company BitTorrent, Inc. develops and distributes a program called BitTorrent which is just one of the many programs that work with the BitTorrent protocol. See this Lifehacker Hive Five on the Best BitTorrent Applications for other recommended BitTorrent clients

    When people talk about 'torrents', they are most likely talking about the set of files they are downloading using the BitTorrent protocol.

  • Phoshi

    uTorrent is a program that uses the bittorrent protocol to share files. It's generally accepted as one of the best clients on Windows, and certainly the best for it's resource usage.

  • hasenj

    BitTorrent is a protocol for file sharing, uTorrent is a program that implements/uses this protocol to share files.

    It's like the difference between HTTP and Firefox. Though Firefox is only a client (not a server); it only implements the client side of the protocol.

    Though, there's also a program called BitTorrent, which was the original BitTorrent client, and according to wikipedia, it's now (after version 6.0) only a re-branded version of uTorrent.

  • William Hilsum

    Bittorrent is the name of the protocol AND a program.

    Bittorrent the company purchased Utorrent, If you are talking about programs, Bittorrent is simply a rebranded version of Utorrent with no additional or different features.

  • Don Salva

    Bittorrent is the peer-to-peer sharing protocol (and its programm in one, the core UI if you will), uTorrent is the programm that utilizes the Bittorrent protocol in order do download and share files.

    utorrent, despite its mixed and/or unsustainable opinions whether its in bed with the media giants or not because the utorrent author sold its source, is one of the best download clients for .torrent files out there.

    So far nothing has been able to beat utorrent to its size, options and resource usage!

    Though there are open source, thus perhaps safer, alternatives like Vuze or Deluge.