> For the complete documentation index, see [llms.txt](https://sliu583.gitbook.io/blog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sliu583.gitbook.io/blog/networking/index/computer-networking-a-top-down-approach/stanford-cs144/chapter-1/1.1-a-day-in-the-life-of-an-application.md).

# 1.1 A Day in the Life of an Application

* Connectivity: connect to one another and exchange data&#x20;

#### Network Application&#x20;

* Read and write data over network&#x20;
* Dominant network: bidirectional, reliable byte stream connection
  * One side reads what the other writes&#x20;
  * Operates in both directions&#x20;
  * Reliable (unless connection breaks)&#x20;

#### Byte Stream Model &#x20;

![](/files/-MgWkGqfIBVlC-qCQVf9)

* Either side can close the connection&#x20;

#### World Wide Web (HTTP)&#x20;

* Hypertext transfer protocol&#x20;

![](/files/-MgWkgZstzUoZr766b6J)

* HTTP: document centric&#x20;
  * Human readable&#x20;
  * Request&#x20;
    * "Get / HTTP / 1.1"
  * Response&#x20;
    * "HTTP/1.1 200 OK"&#x20;

#### BitTorrent&#x20;

* Share and exchange large files&#x20;
* Client request documents from other clients&#x20;
* Swarms&#x20;
* When the client wants to download a file, it first has to find something called a torrent file&#x20;
  * Find it using the www&#x20;
  * Download it using HTTP&#x20;
* torrent file describes some information about:
  * data file you want to download&#x20;
  * tracker: keeps track of what clients are members of the swarm &#x20;
* Dense graphs of connections between clients, dynamically exchanging data&#x20;

![](/files/-MgWm4Db7QD7J_afHS7B)

#### Skype&#x20;

![](/files/-MgWmWAi9DkA82dov_dE)

* NAT: network address translator&#x20;
  * Behind a NAT: can open connections out to the Internet, but other nodes in the Internet can't easily open the connections to you&#x20;
  * Red-green area&#x20;

![](/files/-MgWmsIXZON4IJ_czGHe)

![](/files/-MgWn3yVlw659qSIeUIV)

* Reverse connection (from B to A)
* This happens in Skype
  * Skype client: personal machine (behind NAT, for security)&#x20;

![](/files/-MgWn_paTp0DYceADeCN)

![](/files/-MgWncfqzxrAmJwmWPQ1)
