# Peer-to-peer

> A network where computers talk directly to each other, with no central server in charge.

- Level: Intermediate
- Topics: Networks
- URL: https://tidbit.legios.com.ar/peer-to-peer/
- In Spanish: [Peer-to-peer](https://tidbit.legios.com.ar/es/peer-to-peer/)

Most of the internet is **client-server**: your phone asks a company's server, and the server answers. In a **peer-to-peer** (P2P) network every participant, or **peer**, is both client and server at once. Each one downloads from others and uploads to others, so there is no single machine that everything depends on.

The best-known example is **BitTorrent**. A large file is split into small pieces, and each peer downloads different pieces from many peers at the same time while sharing the pieces it already has. The more people want a file, the more sources it has, which is the opposite of what happens to a server under load. Linux distributions and game updates use it to save bandwidth. The same idea is behind blockchains like Bitcoin, where every node keeps a copy of the ledger, and behind many video calls, which send audio and video straight between participants when NAT and firewalls allow it.

The trade-offs: there is nobody in charge to stop bad content or bad actors, peers come and go so availability is unpredictable, and anyone you connect to can see your IP address. P2P is a way to build networks, neither legal nor illegal in itself; what is shared over it is what matters.

## An analogy

A potluck dinner instead of a restaurant. There is no kitchen that cooks for everyone: each guest brings a dish and takes a bit of the others', and the more guests come, the more food there is.

## Keep in mind

- In P2P every peer both consumes and provides resources.
- BitTorrent splits files into pieces downloaded from many peers at once.
- More users means more capacity, not more load on one server.
- Peers can see each other's IP addresses.

## Go deeper

- [Peer-to-peer on Wikipedia](https://en.wikipedia.org/wiki/Peer-to-peer)
- [BitTorrent on Wikipedia](https://en.wikipedia.org/wiki/BitTorrent)

## Related terms

- [Internet](https://tidbit.legios.com.ar/internet/): A worldwide network of networks that lets any connected device reach any other.
- [Server](https://tidbit.legios.com.ar/server/): A computer whose job is to answer requests from other computers, all day, every day.
- [Linux](https://tidbit.legios.com.ar/linux/): A free, open source operating system that runs most of the internet's servers.
- [Bandwidth and latency](https://tidbit.legios.com.ar/bandwidth-and-latency/): How much data fits per second, and how long each trip takes. Two different things.
- [Blockchain](https://tidbit.legios.com.ar/blockchain/): A shared record book, copied on many computers, where old pages can't be quietly changed.
- [NAT](https://tidbit.legios.com.ar/nat/): How a whole home or office shares one public IP address on the internet.
- [Firewall](https://tidbit.legios.com.ar/firewall/): A gatekeeper that decides which network traffic gets in or out.
- [IP address](https://tidbit.legios.com.ar/ip-address/): The number that identifies a device on a network, like a postal address.
