Flask mega tutorial.
NETWORKING I: TCP/IP
network protocol stack: layers of abstraction that take a complex network of computers & let them communicate with each other
HTTP (built on top of TCP/IP): for servers / web browsers. transfers data using TCP/IP
IP (network-level concept): best-effort packet-switched network. IP is good at routing things but not good at making sure packets are guaranteed to arrive at the end. so, packets might be late or not arrive at all
IP routers (core of internet): IP is connection-less. lives in the present. does STORE & FORWARD. uses its IP address to know what the next location is. Each host knows where to send packets (it has a routing table & forwards packet to "longest prefix match").
let's check our own IP address. terminal: 'ifconfig' shows you all ethernet devices 'en0' = wireless devices 'en1' = wired devices
checkip.dyndns.org = site to tell you your ip address
'traceroute google.com' = shows me all routers that my packets will go through from me to google.com
How does a host get an IP address? used to be static, now DHCP (Dynamic host configuration protocol) = i connect to switch who connects to router who connects to internet
IP address gets mapped to a target Ethernet address through ARP (ADDRESS RESOLUTION PROTOCOL)
ARP spoofing = man-in-the-middle attacks
malicious user = promiscuous mode = watch all the packets/network traffic instead of ignoring everything that's not for you
web browsers cache a site's IP address (so you don't have to keep re-loading it on internal umich.edu sites!)
TCP = TRANSPORT CONTROL PROTOCOL. TCP creates the illusion of some of the nice aspects of a circuit-switched network, while being packet-switched. it knows the end-points though.
PORTS (Operating system-level concept). well-known ports: HTTP: 80 SSH: 22 HTTPS: 443 before gmail, there was desktop email (outlook) there was SMTP: 25 & IMAP: 143 also.
TCP = connections between computers, reliable delivery. it breaks data up into packets, and transmits them based on weights. if data isn't received, it RE-TRANSMITS it. guarantees packets get delivered in order.
- Uses ACK (acknowledgements) to tell if data has been received or not. sender holds onto a copy of the data & waits for ACK to come back.
- FLOW CONTROL: Can't ACK be slow? yes, that's why we use SLIDING WINDOW technique for managing send/receive capacity. sender can send as many packets to fill up the Sliding window. Data might not be received in order, but then is reassembled at the end.
IP = little pieces of data that don't care about the past, might lose packets
TCP connection-setup = 3-way handshake. active participant (client) -> passive participant (server). ACK is x+1.
many sources sending packets -> 1 router = CONGESTION. the TCP sender knows about packet delays / droppings. it can decrease traffic when congestion occurs (on failures), & increase traffic after (on success).
- CONGESTION CONTROL: increases happen incrementally, but decreases happen quickly (cut traffic in half)