> 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;

![](https://2097630930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVORxAomcgtzVVUqmws%2F-MgWiv1HLRLrf8r4_S88%2F-MgWkGqfIBVlC-qCQVf9%2Fimage.png?alt=media\&token=a3253b9b-222f-432c-a00a-f7242eb3ca6b)

* Either side can close the connection&#x20;

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

* Hypertext transfer protocol&#x20;

![](https://2097630930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVORxAomcgtzVVUqmws%2F-MgWiv1HLRLrf8r4_S88%2F-MgWkgZstzUoZr766b6J%2Fimage.png?alt=media\&token=d0628614-49bc-4e35-a0ac-35d29f63c618)

* 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;

![](https://2097630930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVORxAomcgtzVVUqmws%2F-MgWiv1HLRLrf8r4_S88%2F-MgWm4Db7QD7J_afHS7B%2Fimage.png?alt=media\&token=c3c603e5-fefd-4043-91f2-44b220cd53b9)

#### Skype&#x20;

![](https://2097630930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVORxAomcgtzVVUqmws%2F-MgWmJBjv0e_Hp6P18bc%2F-MgWmWAi9DkA82dov_dE%2Fimage.png?alt=media\&token=19f902a6-6e90-4674-8215-c14400c86b13)

* 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;

![](https://2097630930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVORxAomcgtzVVUqmws%2F-MgWmJBjv0e_Hp6P18bc%2F-MgWmsIXZON4IJ_czGHe%2Fimage.png?alt=media\&token=43c6f562-d415-4216-a54b-3cfa8a100a79)

![](https://2097630930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVORxAomcgtzVVUqmws%2F-MgWmJBjv0e_Hp6P18bc%2F-MgWn3yVlw659qSIeUIV%2Fimage.png?alt=media\&token=9cfec249-458c-4039-a127-279b35cffc3b)

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

![](https://2097630930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVORxAomcgtzVVUqmws%2F-MgWmJBjv0e_Hp6P18bc%2F-MgWn_paTp0DYceADeCN%2Fimage.png?alt=media\&token=82309987-d2ad-4d0a-9b84-096ec286cf9b)

![](https://2097630930-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVORxAomcgtzVVUqmws%2F-MgWmJBjv0e_Hp6P18bc%2F-MgWncfqzxrAmJwmWPQ1%2Fimage.png?alt=media\&token=cae23e17-2941-457c-a311-07865cae7e7c)
