# Computer Networks

> Unless otherwise specified, all quotes in this document are based on material from _Intro to Information Systems (5e)_, by Rainer.

A **Computer Network** is a system of interconnected computers which use "communications media" to transmit data to each other.

## Communications Media

**Communications Media** refer to the pathways, or methods, by which data are transmitted. **Cable Media** transmit information over physical wires or cables, whereas **Broadcast Media** (e.g. Bluetooth, WiFi, Cellular radio, Satellite radio) transmit information through electromagnetic waves.

### Cable Media

Cable media are described by their physical composition and each have advantages and disadvantages in terms of capability and cost.

**Twisted pair wire** is a medium comprised of "twisted copper wires" which is commonly used to "transmit business telephone communications". Twisted-pair wire is inexpensive, but "slow ... and subject to (intrusion and) interference."

**Coaxial cable** is a medium comprised of "insulated copper wire" and is commonly used to "transmit high-speed data traffic and television signals". Cable is "less susceptible to interference" but "more expensive and harder to work with" than twisted-pair wire.

**Fiber-optic cable** is a medium comprised of "thin ... glass fibers that transmit information via light pulses generated by lasers". Fiber provides a significant increase in bandwidth and security, but may involve great up-front investment costs, and is "harder to work with" than other cable media.

### Broadcast Media

Examples include:

* Bluetooth
* WiFi
* Wireless Mesh Networks
* Cellular radio
* Satellite radio
* Wireless Broadband

## Network Sizes

Computer networks are often described in terms of size:

| network size                | description                                                                              | example(s)                                                 |
| --------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| Personal Area Network (PAN) | Two ore more devices in a very limited geographical region, usually within the same room | a bluetooth connection between headphones and mobile phone |
| Local Area Network (LAN)    | "two or more devices in a limited geographical region, usually within the same building" | a home WiFi network                                        |
| Wide Area Network (WAN)     | "covers a large geographic region; typically connects multiple LANs"                     | a university network; the Internet                         |

## The Internet

The Internet is the most prevalent computer network in the world.

![some maps of the internet backbone](https://user-images.githubusercontent.com/1328807/52525898-c2f75000-2c7e-11e9-9a30-d17be87fa058.png)

### Internet Architectures

The most common Internet architecture is called **Client-Server**. The **Client** is a computer which makes a request for information, whereas the **Server** provides a response to fulfill the client's request.

### Internet Protocols

Computers connected to the Internet communicate according to a "common set of rules and procedures", or protocols. The following table identifies some of them:

| abbreviation                                                           | name                                                                        | description                                                                                                                                          |
| ---------------------------------------------------------------------- | --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| [HTTP](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol)      | Hyper Text Transfer Protocol                                                | The foundation protocol for the Internet.                                                                                                            |
| [HTTPS](https://en.wikipedia.org/wiki/HTTPS)                           | Secure Hyper Text Transfer Protocol                                         | A widely-used Internet protocol for secure network communication over HTTP within a connection encrypted by SSL/TLS.                                 |
| [SSL/TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security)      | Transport Layer Security (formerly and still known as Secure Sockets Layer) | For providing communication security over a network.                                                                                                 |
| [TCP/IP](#https://en.wikipedia.org/wiki/Transmission_Control_Protocol) | Transmission Control Protocol, which compliments the Internet Protocol      | Provides reliable, ordered, and error-checked delivery of a stream of octets between applications running on hosts communicating over an IP network. |
| [FTP](https://en.wikipedia.org/wiki/File_Transfer_Protocol)            | File Transfer Protocol                                                      | For transmitting large files between computers.                                                                                                      |
| [SMTP](https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol)    | Simple Mail Transfer Protocol                                               | For transmitting electronic mail between computers.                                                                                                  |
| [SSH](https://en.wikipedia.org/wiki/Secure_Shell)                      | Secure Shell                                                                | A cryptographic (encrypted) network protocol to allow remote login and other network services to operate securely over an unsecured network.         |
| [SFTP](https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol)       | SSH/Secure File Transfer Protocol                                           | For transferring files over SSH.                                                                                                                     |

#### IP Addresses

The Internet Protocol primarily governs the routing and delivery of information from one computer to another.

Computers participating in these connections each have an address, or location where the information is sent and received. Just as a street address identifies a building within a connected system of roads and highways, and as a telephone number identifies a phone's connection to a cellular network, an **Internet Protocol (IP) Address** identifies a computer's connection to the Internet. IP Address notation typically includes numbers separated by decimals in IP Version 4 (e.g. _144.228.10.74_), and numbers or letters separated by colons in IP Version 6 (e.g. _2601:37b:c211:7109:7833:f6d1:1f15:9174_).

When information is traveling throughout the network, data is separated into component parts and encapsulated into **packets** which also contain routing information. These packets may or may not take the same route across the network and may or may not arrive at the destination at the same time. Once all the packets are received, they are re-assembled into the original information representation.

#### HyperText Transfer Protocol

Reference:

* [Mozila Reference on HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP)
* [HTTP Documentation](http://httpwg.org/specs/)

The Internet primarily relies on the **Hyper Text Transfer Protocol (HTTP)**, which specifies rules and standards for sending and receiving information.

According to HTTP, a client computer can issue different kinds of requests to the server. A client can either ask for data from the server (known as a `GET` request), or send some data to the server and ask the server to process it (e.g. `POST` and other types of request).

This course focuses primarily on `GET` requests. The most common way a computer can issue a `GET` request is by visiting some URL in a browser. But a computer is also capable of programmatically issuing `GET` requests using command-line utilities and modern programming languages.

See also: [the `requests` package](../python/packages/requests) for issuing HTTP requests in Python.
