CS | Computer Networks Notes No.1

CS | Computer Networks Notes (NO.1)

1-1 A day in the life of an application

Network application

  • Read and write data over network

  • Dominant model: bidreactional, reliable byte stream connection

    • One side reads what the other write

    • Operates in both directions

    • Reliable (unless connection breaks)

First example: The world wide web

The world wide web works using something called HTTP, which stands for the HyperText Transfer.

In HTTP, a client opens a connection to a server and sends commands to it. The most common command is GET, which requests a page.

HTTP was designed to be a document-centric way for programs to communicate.

ln the example of the www.stanford.edu webpage, a 200 OK response would include the HyperText that describes the main Stanford page. There are other kinds of requests,such as PUT, DELETE, and INFO, as well as other responses such as 400 Bad Request.

Second example: BitTorrent

BitTorrent is a program that allows people to share and exchange large files.

Unlike the web, where a client requests documents from a server, in Bitiorrent a client requests documents from other clients. So that a single client can request from many others in paralel, BitToerent breaks files up into chunks of data called pieces.

When a client downloads a complete piece another client, it then tells other clients it has that piece so they can download it too. These collections of collaborating clients are called swarm. So we talk about a client joining or leaving the swarm.

BitTorrent uses the exact same mechaiem as the world wide web: a reliable, bidirectional data stream. But it uses it in a slightly more complex way. When a client wants to download a file, it first has to find something called a torrent file, Usually, you find this using the world wide Web and download it using, you auessed it, HTTP. This torrent file describes some information about the data file you want to download. lt also tells BitTorrent about who the tracker is for that torrent.

A tracker is a node that keeps track (hence the name) of what clients are members of the swarm. To join a torrent, your client contacts the tracker, again, over HTTP, to request a list of other clients. Your client open connections to some of these clients and starts requesting piece of the file. Those clients, in turn, can request pieces on your own. Futhermore, when a new client joins the swarm, it might tell this new client to connect to your client. So rather than a single connection between a dlient and one server. vou have a dense graph of connections between clients, dynamically exchanging data.

Example 3: Skype

It doesn't have any official documentation on how it works internally.

In 2011, however, Efim Bushmanov reverse engineered the protocol and published open source code.

This called ‘’reverse connection’’

So what dose Skype do if both clients are behind NATs? To handle this case, Skype introduces a second kind of server, called a relay.

1-2 The 4 layer Internet Model


Bi-directional reliable byte stream between two applications,using application-specific semantics

  • http / bit-torrent / ...


Guarantees correct, in-order delivery of data end-to-end.Controls congestion.

  • TCP / UDP / ...


Delivers datagrams end-to-end.Best-effort delivery- no guarantees.

  • Must use the lnternet Protocol (IP).


Delivers data over a single link between an end hostand router, or between routers

In summary

Bidirectional, reliable byte stream

  • Building block of most applications today
  • Other models exist and are used, we'll cover them later in the class

Abstracts away entire network -- just a pipe between two programs

Application level controls communication pattern and payloads

  • World Wide Web (HTTP)
  • Skype
  • Bit Torrent

Four layers:

IP is the "thin waist":