top of page

Basic BitTorrent and Peer to Peer Networking Explained

Basic Networking: IP Addresses and Port Numbers

When your computer connects to the Internet (whether via dialup, DSL, cable modem, or whatever), it has to have a unique identifier associate with it, so that all of the other computers on the Internet can talk to it (similar to a telephone number.) This identifier is called an IP address. Since computers work best with numbers, an IP address is actually just a really big number. When your computer wants to download something like a file or a web page (or upload, for that matter) it figures out what the IP address is for the computer you are talking to, and it tells the computers around it that it wants to talk to the target computer.

Since computers can talk to many different computers at once, and can talk about a variety of different things (web pages, file sharing, video downloading, real time audio, etc.), they have to have a way of differentiating which conversations are about what. Again with the numbers, computers on the Internet group all related things by giving them the same port number. For example, web pages tend to be on port 80, secure web pages are on port 443, programs from companies for download (like shareware) tend to be on 21, and so on. It is the combination of the IP address and the port number that makes the conversation between two computers happen.


Basic File sharing: Client-Server and P2P

A few years ago the Internet was pretty easily divided into two groups: servers and clients. (Just like at a restaurant.) There weren't that many servers, but their primary job was to hold web pages and files to be downloaded. They didn't do much other than sit there and wait for people like you to request a web page or file. You, as the client, probably didn't share any files or web pages with anyone. This segregation was primarily due to the fact that it takes a lot of outgoing bandwidth to share stuff. In a time before broadband DSL and cable modems, back in the days of dialup, most people didn't have the bandwidth, let alone the knowhow to share stuff on their own. This old system was called client-server, appropriately enough, and it is still used today for the vast majority of stuff on the Internet, including web pages.


With the advent of broadband technologies such as DSL and cable modems, the everyday user like yourself suddenly has a big chunk of bandwidth, not only for download, but also upload. Sharing files directly from your computer (without first sending them to a server) is now a reality. This is where p2p comes in. The acronym p2p stands for peer-to-peer, which basically means client to client. That is, you download files from people like you instead of from big servers, and in turn they download files from you. You share your files, your friends share their files, and everyone talks directly to each other.


Basic P2P

We'll use three people to demonstrate the concepts here: Alice, Bob, and Charlie. For all of the examples, we assume that Alice is a total newbie and has just installed her first p2p software, has nothing to share, and is looking to download something. Bob is sharing a few things, but is also looking for more stuff to download. Charlie is sharing a bunch of stuff but doesn't spend much of his time looking for new stuff to download.


For pretty much all p2p systems most people follow these basic steps:


Search for something

Get a list of everyone who is sharing what they want

Go through the list and ask each person on it if they will please send the file

Once the file is complete, start sharing it with other people in the system


So, Alice searches for a movie, finds out that both Charlie and Bob have it, and asks both of them to please send her the file. If they aren't too busy helping other people, hopefully they'll be able to help her out. Once she has the file, she starts sharing it as well, so that other people can get it.


BitTorrent follows this progression closely, with a few differences. In many systems (such as Napster, KaZaA, or eDonkey) searching for a file is built right into the program. BitTorrent isn't meant to be a full-blown network like they are, and so it doesn't have this feature built-in. You have to find the torrents yourself, probably with Google or some other popular search engine. The other difference is in the way sharing works.


Basic BitTorrent Sharing

The problem with most P2P networks is that many people just don't like to share. They open up their program, download their files, then close the program before they can help anyone else. It's called leeching. Behavioral judgements aside, if everyone did this then nothing would ever get shared! To combat this, BitTorrent has gone back to the way of sharing you were probably taught as a young child: trading. Instead of waiting for the complete file to download before it starts to share, BitTorrent downloads the file in small pieces and shares each piece as it finishes. This makes it easier to get the file from many different people at once, thereby increasing the probably that you'll get a good download speed. It also means that downloading a file is more reliable than in some other networks. If Charlie has half of a file and Bob has the other half, Alice can get each half and put them together to get the whole file.

But this piecewise downloading doesn't necessarily combat the leech problem. As a backup plan, BitTorrent built in the other half of trading you probably learned as a kid: tit-for-tat. That is, if you give me one piece, I'll give you one piece back. BitTorrent will give you a few pieces of the file for free to help you get started, but after that you need to start giving some pieces back if you want to keep downloading. If you don't share, eventually everyone else will stop talking to you. Just like when you were a kid with your toys on the playground. In fact, BitTorrent goes one step further and actually starts to favor the people who share the most. This means that the more you upload, the faster you'll download.

For example, Alice gets a few pieces of a file from Bob for free. She can then give those pieces to Charlie, if he doesn't already have them, which will motivate Charlie to return the favor and give her a bunch of pieces that she doesn't have. She then goes back to Bob with those pieces, and the cycle continues and grows. Why don't Bob and Charlie talk directly? Maybe they do but they haven't gotten to those pieces yet. Or maybe their systems aren't configured right and they can't talk directly to each other.

How does all this start? With BitTorrent, it starts with a tracker. Like the name suggests, a tracker keeps track of people who are interested in torrents. When you download a .torrent file it contains a link to a tracker as well as an identifier (hash) which is unique to that specific torrent. Your BitTorrent client then connects to the tracker and asks for a list of all people interested in that torrent. At the same time, the tracker adds you to that list so that other people know that you are interested. Your BitTorrent client will also periodically asks the tracker for an updated list. That's all a tracker does: keep track of that list for each torrent, and give it out to people who are interested. The tracker does not know anything else about the torrent, nor does it send you the file. It just shows you where to go to get the file.


Piracy and Illegal Downloading

P2P Sharing can be beneficial and legal depending on content. Most copyrighted material is illegal to share. But some content is legal. As a matter of fact, some large companies are distributing drivers and software programs using BitTorrent or similar technologies. The important thing to remember is that you are not anonymous! The trackers keep your IP addresses and the IP addresses will lead right back to you. MPAA and RIAA have come after many people downloading illegal content. Be aware of what your kids are doing and what they are downloading. Most ISP’s will send you a cease and desist letter, but if someone decides to prosecute or seek damages, they will not protect you.

bottom of page