Time to Transmit formula = Latency + Size / Bandwidth Get the units right 1 KB = 1024 Bytes 1 byte = 8 bits 1,000 ms = 1 second Aloha Classic Slotted Why is it beter Reservation Why is it better Ethernet Collision Handling Jam Wait randomly resend Does not do ACKS or timeouts or resend on packet loss ... that's TCP. MAC addresses Not network and host divided All 111 means broadcast All 000 means self MAC addresses are not IP addresses Ethernet format Be able to find 'what is byte 42' Has a checksum .. won't pass bad data. IP Purposes End-End, Routing, Not Reliable, Not ordering IP format Time to live Out of addresses! IPv6 has more addresses, but not widely used. IP Numbers Are divided into the network and host portion Written in dotted decimal notation All 1's means broadcast. All 0's means this. Some numbers are local use only 192.168.X.Y 10.X.Y.Z We are out of numbers!!! TCP Purposes -- Congestion Control, Reliability Who uses TCP 3 packets to start + 2 packets to end Retransmission and sliding window protocol ACKS acknowledge everything below Timeout computation Sliding Window Used by TCP on send, start timer. If timer goes off, resend when you get data, ack 'what you want, not what you got'. when you get data (even repeat data), always ack. UDP not used in our class unreliable out-of-order delivery faster used by streaming media/DNS/others HTTP Purpose Versions 0.9, 1.0, 1.1, 2, 3 0.9 No metadata No file types -- receiver guess 1.0 Metadata 1.1 Metadata socket keepalive 2 Use binary compression, chnage from TCP to QUIC, other stuff 3 Even better version of 2 Metadata Must include status code (i.e. 200 OK) May include Server type File type File size anything else Caching based on last modified time or etag huge perfomnace improvement SMTP Purpose -- Deliver email and NOT inbox searching Protocol MIME encoding Mail goes to the MX record for the domain dig -t mx amazon.com RSA and HTTPS What is public key crypt how do i send a private message how do I sign a document what is an X509 Cert Network Address Translation Solves the problem of "I have more devices than IP numbers" Used by your cable modem Without port forwarding, only allows for outgoing connections DNS Translates between IP numbers and host names Can use foreign letters There are central servers, plus a name server for each subdomain How it works (just the basics) Wifi (SKIP) Has request-to-send, clear-to-send, send, ack. (SKIP) Some Wifi should not have collisions Has lots of types: a, b, c, n, ac Bandwidth goes from 1 mb/sec for b, to more than 1Gb/sec for ac at long range, bandwidth goes down (SKIP) channels overlap It's encrypted Programming null terminating len = read(fd, buf, MAXLEN); buf[len] = 0; // what about errors? Converting a null terminated char* into a string and back // convert a char* into a string string name = the_array; // Get a char* out of a string name.c_str(); Reading/writing a string write(fd, str.c_str(), str.length()); int len = read(fd, buf, MAXLEN); buf[len] = 0; string str = buf; Reading/Writing binary data Don't assume it's a string Don't null terminate Don't call strlen() or variable.length() fork() returns twice everything is cloned -1 on error returns pid if you're the parent returns 0 otherwise poll -- who has data ready to read read-write -- what are the args, what does it return connect returns a fd or -1 on error used by client to connect to a server accept used by server returns fd to read/write on returns -1 on error THINGS NOT ON THE FINAL EXAM BGP Routing for the Interwebs Autonymous Systems Not optimal but good Routing Table Example: 123.45.67/24 75,5432,98754,12 few hundred thousand entries DHCP Used to give a host an IP number on boot IP numbers are leased, and can be renewed or expire. ARP Purpose -- translate an IP into a MAC Caching Protocol