Packets, torrents and pressing play

A chat over three days, kept as it went: the questions as they were asked, tidied, the answers cut down, figures put in, and what turned out wrong marked where it was said.

  1. 01Packets, VPNs, torrents
  2. 02A VPN, slowly
  3. 03Stremio
  4. 04A VPN for torrenting
  5. 05Addons, and what Torrentio does
  6. 06Magnet link
  7. 07Why localhost
  8. 08What a torrent is
  9. 09Do torrents hog the internet
  10. 10Where Claude's prompt lives
01 · You

Looking back at the /usr/local/bin chats: I want to go into computer networks a bit. Torrents, VPNs, packets and all that. They're all magic.

Claude

Those chats were about the plumbing on your own machine. Networking is the same instinct pointed outward: how does a file, a request or a video get from your machine to another one across the world? Everything on the internet comes down to one trick: chop data into small labelled envelopes, hand them to your neighbour, and let each neighbour pass them on until they arrive.

  • Packets. Your computer never sends "the page". It sends thousands of small chunks, , each stamped with where it's from, where it's going and its place in the order. Each router on the way reads only the destination and forwards it one hop closer. Nobody knows the whole path; everyone knows the next hop. That's why the internet survives a cut cable: packets go round the damage. The receiver puts them back in order and asks again for any that went missing.
  • VPNs. A takes every packet leaving your machine, encrypts it, and wraps it in another packet addressed to the VPN's server. The café Wi-Fi and your provider see only that you're talking to a server in Amsterdam. The server unwraps the inner packet and sends it on, so the website sees Amsterdam, not you. An envelope inside an envelope.
  • Torrents. Normally you download from one server, and if it's slow or goes down, so does your download. BitTorrent splits the file into pieces, and everyone who has some shares them with everyone who needs them: piece 40 from Brazil, piece 41 from Poland, and the moment you have piece 40 you pass it on. A small torrent file or lists the pieces' checksums and how to find other people. No central copy, so it's resilient and hard to shut down.
Fig 01
The peer
From198.51.100.23 (the peer)To203.0.113.7 (you)Carries1,460 bytes of piece 412

Piece 412 leaves the peer as about 180 packets. This is one, stamped from the peer, to you, with its number in the sequence.

One packet of a piece, crossing from a peer to you a hop at a time.

They feel like magic because each layer hides the one beneath: the browser doesn't know about packets, packets don't know about tunnels, and the tunnel doesn't care whether there's a torrent or an email inside.

02 · You

"Your ISP and anyone on the café Wi-Fi see only that this person is talking to some server in Amsterdam. The VPN server unwraps the inner packet and sends it on its way, so the website sees Amsterdam, not you." You kind of lost me here.

Claude

Without a VPN. At a café you go to netflix.com. Your laptop builds a packet stamped from your laptop, to Netflix. It goes to the café router, the café's provider, then across the internet. Every hop can read the stamps: the café knows you're on Netflix, the provider knows, and Netflix knows the request came from that café.

With one. Your laptop builds the same packet, but before sending it the VPN software scrambles it and puts it inside a new packet stamped from your laptop, to the VPN server in Amsterdam. That outer packet is what travels. The café and the provider see a laptop sending something to Amsterdam, and nothing about Netflix. In Amsterdam the server unscrambles it, takes out the original, puts its own address as the sender, and sends it on. Netflix sees a request from Amsterdam. The reply comes back the same road.

Fig 02
In inkYour address, where it can be read

Without a VPN, everyone along the way reads your address on every packet, and where it's going. HTTPS hides what's inside, not that.

Who can see what, with a VPN off and on. Your address is in ink wherever it can be read.

So two parties are kept in the dark in two different ways. The people near you can see you're talking, but not to whom. The website can see what you ask for, but not who you are. Only the VPN sees both, which is why choosing one you trust matters.

03 · You

Going back to torrents: I have the Stremio app, and you'd explained a bit, where my interest was, that it's using my localhost IP address. You said it also had its own server that actually does the outbound network. Could we go back to that? I use the app, but I never really understood how it works until I started deleting files and found out that Stremio has a cache of video files, so that you can scrub or something like that.

Claude

That was the 25 GB stremio-server folder. Stremio is two programs. The icon you click is the app: the catalogue, the interface, the player. Behind it, it starts a second program, stremio-server, the torrent engine, the part that talks to the outside world.

Why localhost. Both run on your Mac, but they talk the way a browser talks to a website, over HTTP. The server listens at http://localhost:11470, and means "this machine". The app never has to know anything about torrents; it asks for the video at an address and the server does the hard part.

Pressing play. An , Torrentio say, gives the app a magnet link. The app passes it to the server. The server goes out to the , downloads pieces from other people, and stitches them together in order, while serving them to the player as an ordinary video stream. The player never sees a torrent.

Fig 03
Step 1 of 5
  1. 1Stremio appYour Mac
  2. 2stremio-serverYour Mac
  3. 3TorrentioSomeone else's server
  4. 4Other peersThe swarm

1 / 5You open the film. The app asks Torrentio, out on the internet, what streams there are for it.

Carriestt1254207, Big Buck Bunny's IMDb ID
Pressing play, one message at a time. Ink is whoever is acting.

The cache is the stitched-together file. An ordinary torrent client takes pieces in whatever order they come; video needs them in order. So the server asks first for the pieces near the playhead, writes everything to disk, and keeps it. Skip back five minutes and it's already there; skip ahead and it asks for that part next. Once the film is over, the pieces stay, each film a full copy, until something clears them.

And while it downloads, it uploads pieces to other people: you're a , not only a client. So your Mac's address is visible to everyone else in that swarm.

04 · You

So I should use a VPN when I'm torrenting.

Claude

That depends on what you're torrenting. The technical fact is simple: in a swarm, every peer sees the address of every peer it trades with. That's not a leak; it's how the protocol works, since you need an address to send packets to. So anyone who joins the swarm for a film, including companies hired by rights holders, gets a list of addresses and times. Your provider can also see you exchanging traffic with hundreds of addresses, though not what's in it. A VPN changes both: the swarm sees the VPN's address, and your provider sees encrypted traffic to the VPN.

Whether you should is another question. For legal torrents, there's nothing to hide and a VPN adds a hop. For current films through Torrentio, that's copyrighted material, and the VPN would be hiding you from people with a legitimate interest in finding you; how much risk that carries varies a great deal by country. If you use one: not every VPN allows peer-to-peer traffic, some leak your real address if the connection drops (hence a "kill switch"), and it has to be on before Stremio starts. Debrid services such as Real-Debrid download the torrent on their servers and hand Stremio an ordinary web link, so your Mac never joins a swarm.

05 · You

I didn't understand the Torrentio part. Two things. One: now that I understand the Application Support folder, which stores anything the app needs and not necessarily cache, I'm realising an addon would be one of the things put in that folder. Two: what does Torrentio do, exactly, that the Stremio server can't?

Claude

An addon isn't on your Mac. It's a small website running on someone else's server. Installing Torrentio saves only its address, https://torrentio.strem.fun/manifest.json, in the app's settings. That settings file is in Application Support, but it's a bookmark, not the addon. If Torrentio's server went offline, it would vanish from your app though you changed nothing. stremio-server is the opposite: a real program on your disk that works with no internet at all. Three pieces, then: the app on your Mac, the server on your Mac, the addon on the internet.

Torrentio finds things. The server is a downloader: hand it a magnet link and it fetches and streams it, but it has no idea which torrent is the film you want, and can't search. Torrentio is the search. Stremio sends it the film's IMDb ID; Torrentio has already crawled torrent sites and indexed what it found, and answers with a list: this one is 4K, 12 GB, 800 seeders; this one 720p, 1.5 GB, 40. You pick, and only then does the link go to the server.

Finding happens on someone else's server; fetching happens on yours. That split is why Stremio itself can ship no search and no content, only the plumbing.

06 · You

Magnet link, huh? When you're explaining and you use something we haven't talked about, maybe give a very small explanation of what it is. A magnet link is lingo in the torrenting world, I guess, so you could explain it.

Claude

A magnet link replaced the .torrent file. To start a torrent you used to download a small file holding the list of pieces, their checksums (fingerprints that prove each piece arrived intact) and the address of a , a server that introduces people to each other. A magnet link folds the essential part into one line of text: magnet:?xt=urn:btih:5a8f3c…&dn=Movie+Name.

The long string after btih: is the , the torrent's fingerprint, and that's all a client needs: with it, the server asks the swarm who has the torrent with this fingerprint, and they send the piece list and everything the .torrent file used to carry. dn is only a name to show. A swarm is everyone sharing a torrent right now; are the ones with the whole file, only uploading.

07 · You

Why localhost? Why do we need localhost, and then another Stremio server? Why can't the Stremio server be everything at once, apart from Stremio's interface?

Claude

Localhost isn't a third thing. There are two programs, and localhost is the address the app uses to reach the server when both are on the same machine. And the server already is everything except the interface: it finds peers, downloads and checks pieces, writes the cache and serves the video. The real question is why the two halves are separate programs talking over the network, instead of one program calling its own functions.

  • Video players speak HTTP. The app's player knows how to play an address, not a torrent. The simplest way to turn pieces into an address that sends bytes in order is to make the torrent engine a small web server.
  • The server can live somewhere else. Since they talk over the network, the server can run on a home server or a spare computer, and the app on a phone or TV can point at it. Localhost is the case where "somewhere else" is the same Mac.
  • One engine, many faces. Desktop, web, TV and phone apps can all use the same server, because what joins them is just HTTP.
  • A crash stays put. If the engine chokes on a bad swarm, the interface stays up.
Fig 04
GET http://127.0.0.1:11470/…
The request
Never leaves the Mac. It goes out through the network software and straight back in.
Who downloads
This Mac
The player sees
A web address that sends a video. The same in both.
The same request with the server in two places. Only the address changes.

This shape has a name: client and server, or front end and back end. It's your browser talking to a website, or the claude command talking to Anthropic's API. Stremio runs both ends on your laptop, which is why you got to see the seam.

08 · You

Let's start from what a torrent is first, technically speaking. Then connect it back to the magnet link.

Claude

The problem. Download from one server and its upload is shared among everyone downloading, so popular files get slow, and if it goes down the file is gone. BitTorrent makes the downloaders share with each other, so the more people want a file, the faster it gets.

  • Split the file. A 2 GB film is cut into equal pieces, usually 256 KB to a few MB, so maybe a thousand, numbered. Each can come from anyone, in any order.
  • Fingerprint each piece. Run a piece's bytes through a function and you get a short number; change one byte and it changes completely. Download piece 412 from a stranger, hash it, compare, and you know it's not garbage. If it doesn't match, throw it away and ask someone else.
  • Describe the torrent. The piece fingerprints, the name, the size and the piece size make up the description. Hash that, and you have the info hash: one fingerprint for the whole torrent.
  • Find people. A tracker is a server that only makes introductions: tell it the info hash and your address, and it gives you others who said the same. It never touches the file. The does it without a server: the peers themselves hold a giant shared phone book, and you ask a few, who point you to others closer to the answer, until you reach a list of peers.
  • Trade pieces. Peers say which pieces they have; you ask for what you're missing, rare ones first so the swarm doesn't lose them, and offer each verified piece on. Those who upload to you get your uploads first: tit for tat stops people only taking.
  • Put it together. Once every piece is verified, write them in order, and there's the film.

And the magnet link. The .torrent file handed you the description and a tracker. The magnet link carries only the info hash. That seems too little, but the DHT can find peers from the hash alone; you ask one for the description, check it hashes to the fingerprint, and now you have everything the file would have given you.

Fig 05
You

The magnet link is only the fingerprint, and a name to show. Nobody has been asked anything yet.

The descriptionNot yet
From a magnet link to the full description, a hop at a time through the DHT.
Fig 06
0 pieces on disk

Play. The server asks peers for the first pieces before anything else.

▼ PlayheadInk on disk · outline coming
A film's pieces as a streaming engine fetches them. Ink is on disk; an outline is coming; dots are not asked for yet.

File, pieces, piece fingerprints, description, info hash, magnet link. Pressing play runs it backwards.

09 · You

So is it true or false, the myth that downloading torrents uses so much internet that other people can't use it?

Claude

True in effect, for a reason most people don't expect. A torrent uses no more data than a normal download; 2 GB is 2 GB. What differs is how hard it pushes. A normal download is one stream from one server and rarely fills your line; a torrent client opens 50 to 200 connections at once and fills your download completely.

The bigger culprit is upload. Home internet is lopsided, say 300 Mbps down and 20 up, and a torrent client uploads to other peers as fast as it can. Every packet you receive has to be acknowledged by a small one going back out, and if the upload is jammed with pieces, the acknowledgements queue behind them, the sender waits, and downloads across the house crawl while the download pipe has room. The router piling up packets rather than dropping them, so the delay balloons, is called .

Fig 07
Your acknowledgement waits
400 ms
A round trip
420 ms
Downloads in the house
19 of 300 Mbps

The thin upload pipe is full of pieces for other peers. Your acknowledgements wait behind them, so every download slows, though the download pipe has room.

A house's line with a torrent uploading, capped or not. The line is an example; the shape is true.

The fix is the same in every client: cap the upload at about 80% of your real upload speed. Stremio's server shows little control here, but it downloads only while you watch, in order, so it tends to be gentler than a full client. It still uploads while playing, though.

10 · You

So, in the context of where things live, in terms of Claude: I've always heard about three levels to how the Claude model works. There's the system prompt, then another prompt in between or something, and then the prompt I've written in the text field. Could you briefly reconnect that for me, in the context of the file system and where things are, and what we've talked about? And I'd also like to see where skills are stored.

Claude

The model never reads files. Every time you send a message, a program assembles one big block of text and hands it to the model. The three levels are three sources it's assembled from, and where each lives depends on the product.

  • The system prompt, written by whoever built the product. In the chat app, that's Anthropic's, on Anthropic's servers, nothing on your Mac: the /usr/bin of it, shipped with the system and not yours to edit.
  • The middle layer. In the chat app, your project instructions, preferences and memory: on Anthropic's servers, but written by you. In Claude Code it's a file, CLAUDE.md: ~/.claude/CLAUDE.md for everywhere, and one in a project's folder for that project. The same pattern as ~/.zshrc beside a project's own config.
  • Your message, which lives nowhere until you send it.

Skills plug into the assembler. A skill is a folder with a SKILL.md in it, a playbook for one kind of task. Only each skill's one-line description is put in; when a task matches, the whole file is read in then. In Claude Code, your own skills go in ~/.claude/skills/ and a project's in its .claude/skills/, and changes there are picked up without restarting. This chat has skills too, on the small Linux computer it comes with: /mnt/skills holds Anthropic's (docx, pdf, xlsx) and yours, such as /mnt/skills/user/unslop/SKILL.md.

The system prompt is theirs, like /usr/bin. CLAUDE.md and skills are yours, in dotfolders. The model sees only what was assembled at the moment you sent.

Terms