************************************ I. Study Guide: (Oct. 1, 2003) ************************************ A. General Guideline: 1. Study the summary in each chapter. 2. Study the lecture notes. 3. Study the homeworks. 4. Study those sample codes shown in the class. 5. Study the textbook. 6. Do the exercises. B. Review for the Test 1: 1. Understand the basic terminologies. 2. Understand OSI and Internet architecture (Chap 1) 3. Understand transmission media (Chap 2) 4. Understand framing and error detection (Chap 3) 5. Understand socket API in C and Java (client and server) (Lab) ************ II. Summary ************ -------------- 1. Introduction -------------- A computer network - an interconnected collection of autonomous computers. Networking Goals: 1. Resource sharing - e.g., shared printer, shared files. 2. Increased reliability - e.g., one failure does not cause system failure. 3. Economics - e.g., better price/performance ratio. 4. Communication - e.g., e-mail. A network is composed of hardware devices and protocol software. OSI 7-Layer Reference Model 1. Physical Layer - transmission of raw bits over a physical channel. 2. Data Link Layer - provide an error-free, point-to-point link to transmit data and control frames between two directly connected nodes. 3. Network Layer - provide a point-to-point link between any two switching nodes (routing, congestion control). 4. Transport Layer - provide a link between any two hosts (connection-oriented or connectionless). 5. Session Layer - manage a conversation between two peer session entities. 6. Presentation Layer - present data in a meaninful format (compress, encode, and convert data). 7. Application Layer - user applications (e-mail, ftp, etc.). Internet Architecture (TCP/IP Protocol Suite) 1. Application Layer - ftp, e-mail, user applications 2. Transport Layer - TCP, UDP 3. Network Layer - IP, ICMP, IGMP 4. Data-Link Layer - Ethernet driver Example Networks The Internet Connection-oriented Networks: X.25, Frame Relay, and ATM Ethernet Wireless LANs: 802.11 ----------------- 2. PHYSICAL LAYER ----------------- Nyquists Theorem: A filtered signal, run through a filter of bandwidth H, can be completely reconstructed by taking 2H samples per second. If the signal has V discrete levels then the max. data rate = 2H log_2 (V). Data Transfer Rate The time, T, required to transmit one character depends on: - the encoding method - the baud rate (signalling speed) which is the number of times per second that the signal changes its value. Note: baud rate is not the same as bit rate. Guided Transmission Data Magnetic media Twisted pair Coaxial cable Fiber optics Wireless Transmission Electromagnetic spectrum Radio transmission Microwave transmission Infrared and millimeter Waves Lightwave transmission Types of modulation Amplitude modulation - use two different voltage levels. Frequency modulation - use more than one tone. Phase modulation - shift the wave by a specific number of degrees. Connection full duplex - allows traffic in both directions simultaneously half duplex - allows traffic either way at a time simplex - allows traffic one-way Traditional System Multiplexing - Frequency Division Multiplexing (FDM) e.g., AM Radio 500-1500kHz each station is on a different frequency. - Time Division Multiplexing (TDM) e.g., Programming on each station. - Wavelength Division Multiplexing (WDM) a variation of FDM used for fiber optic channels Types of Traffic Continuous - all of the assigned bandwidth is used continuously; e.g., human voice traffic. Bursty - the assigned bandwidth is used intermittently; e.g., most computer traffic. Types of Switching - Circuit Switching - An end-to-end path from the sender to receiver must be established before the data is sent. Once the path is setup, the only delay is due to propogation delay: 1000 km in 6 msec (electromagnetic bound). - Packet Switching - A fixed length message (called a packet) is sent to the first switching node, stored there, and forwarded later. Packets are buffered in main memory at the switching node. Problem: Different Data Transfer Requirements Neither circuit switching or packet switching is suitable for both continuous and bursty traffic. Compromise: use fixed-size blocks over virtual circuits; this scheme is called Asynchronous Transfer Mode (ATM). The Mobile Telephone System - First-Generation Mobile Phones: analog Voice - AMPS - Second-Generation Mobile Phones: digital Voice - D-AMPS, GSM, CDMA - Third-Generation Mobile Phones: digital Voice and Data - W-CDMA, CDMA2000 ADSL versus Cable - Theoretically, coax is hundreds of times more than twisted pair. But, the full capacity is not available for data users. - In practice, ADSL providers achieve about 80% of the bandwidth. Cable depends on how many people are sharing the cable. - Being a point-to-point medium, ADSL is more secure than cable. - The telephone system is more reliable than cable. - Most ADSL providers offer a choice of ISPs (sometimes, required by law). ------------------ 3. DATA-LINK LAYER ------------------ The lowest part of the data-link layer is called the Medium Access Control (MAC) sublayer. The highest part of the data-link layer is called the Logical Link Control (LLC) sublayer. Types of Networks - Use point-to-point connections; e.g., most WANs (except satellite). - Use broadcast channels; e.g., most LANs (except wireless). Broadcast Channel Objectives Maximize channel utilization. Minimize channel access delay. Data-Link Layer Issues a. Framing - packets from the network layer are segmented into frames. Character stuffing and bit stuffing can be used for framing. b. Error Control - a checksum is computed for each frame to detect or correct bit errors. c. Flow Control - throttle the sender if the data is coming too fast. d. Link Management - either connection-oriented or connectionless links. Framing Idea: Mark the start and end of each frame with a special character. - Character stuffing. - Bit stuffing. Error Detection and Correction An n-bit codeword consists of: m data bits r check bits (called checksum) The Hamming distance between two codewords is the number of bit positions in which the two codewords differ. Hamming Distance of a Code A code is a collection of valid codewords. The Hamming distance of a code is the minimum Hamming distance between any two codewords in the code. Error Detection and Correction - To detect d errors, we need a d+1-code; that is, a code with a Hamming distance of d+1. - To correct d errors, we need a 2d+1-code. A correction is performed by rounding off to the nearest valid codeword. A Hamming Code can be used to correct one error; that is, it is a 3-code. Cyclic Redundancy Code (CRC) Sender and receiver agree on a generator polynomial G(x) such that both high and low order bits of the generator are 1, and the degree of G(x) is r. Let M(x) denote the data frame. The checksum is computed by dividing x^r M(x) by G(x). Elementary Data Link Protocols Unrestricted Simplex Protocol connectionless sender tx frames with no ack. receiver must have infinite buffer. Simplex Stop-and-Wait Protocol sender sends next frame only after receiving an ack. receiver has a finite buffer. Positive Ack. and Retransmission (PAR) Protocol Simplex Stop-and-Wait for a noisy channel. if frames may be lost, a timeout is required on the sender side. since only adjacent frames may conflict, a one-bit sequence number can be used. Window-based Protocols In stop-and-wait protocols, latency at the sender is high. So, the channel utilization is low. In window-based protocols, the senders window is the range of sequence numbers that the sender is allowed to send before blocking (waiting for an ack.). Retransmission Protocols go-back-n: the receiver only accepts the next frame in the sequence. There are 2 methods: a. recovery by timeout - the receiver discards subsequent frames and waits for the sender to timeout. b. special frame - the receiver acks with a special frame to inform the sender to retx from the missed frame. selective repeat : the receiver accepts any frame in its window, but only acknowledges the last frame in the successful sequence. As above, there are 2 methods: a. wait for the sender to timeout b. send the sender a special frame Examples of Data-Link Layer Protocols HDLC PPP ------------------ Socket Programming ------------------ 1. socket - create an endpoint for communication. 2. bind - bind a socket to an address. The address is a pair consisting of an IP-address and a port number. 3. listen - specify the maximum number of outstanding connection requests that can be enqueued; that is, the connection request queue length. 4. accept - wait to accept an incoming connection request. Use by a server to wait for an incoming request. When a request arrives, a new socket is created and the new socket is used for the connection. 5. connect - initiate a connection request. Used by a client to connect to a server. 6. write, sendto - send data using a connection-oriented (TCP), or connectionless (UDP) protocol, respectively. 7. read, recvfrom - read data using a connection-oriented (TCP), or connectionless (UDP) protocol, respectively. 8. close - close a connection. 9. shutdown - terminate a connection in one direction (used to gracefully terminate connections). *********************** III. Sample Questions: *********************** A. Multiple Choice Questions: 1. Match the following terms: Ethernet card ____ UDP ____ IP ____ ping ____ ftp ____ TCP/IP protocol suite ____ Choices: (a) hardware (b) software (c) protocol (d) network architecture. ANSWER: Ethernet card (a) UDP (c) IP (c) ping (b) ftp (b) or (c) TCP/IP protocol suite (d) (c) 2. Which transmission media can achieve the highest bandwidth? (a) twisted pairs (b) coaxial cable (c) fiber optics (d) microwave (c) 3. Teledesic is a statellite communication system based on (a) GEO (b) MEO (c) LEO (d) TEO (d) 4. Which is not the modulation method? (a) amplitude (b) frequency (c) phase (d) time (d) 5. Which modulation is used in V.90 to achieve the 56 kbps transfer rate? (a) QPSK (b) QAM-16 (c) QAM-64 (d) QAM-128 (a) 6. Which uses the circuit switching? (a) POTS (b) X.25 (c) Frame Relay (d) ATM (b) 7. Which statement about ADSL is false? (a) ADSL can achieve about 80% of the designated bandwidth. (b) More users will reduce the performance for existing users. (c) ADSL is more secure than cable. (d) Most ADSL providers offer a choice of ISPs. (a) 8. Which is not issues to be concerned with in the data link layer? (a) routing (b) framing (c) error control (d) flow control (c) 9 Which bit pattern is used as the flag in bit stuffing? (a) 00000000 (b) 10000001 (c) 01111110 (c) 11111111 (b) 10. Which is a data link layer protocol? (a) IP (b) PPP (c) TCP (d) FTP B. Question and Answer: 1. Define the following: A. computer network B. network architecture C. OSI 7-Layer Reference Model D. connection-oriented protocol E. connectionless protocol F. socket G. port H. application programmer interface I. peer-to-peer communication J. LAN K. WAN L. HTTP M. ATM N. WiFi O. frequency hopping spread spectrum P. direct sequence spread spectrum Q. QAM-64 R. ADSL S. PCM T. piggyback U. PPP 2. Imagine that you have trained your St. Bernard, Bernie, to carry a box of 100 data CD instead of a flask of Budweiser. These CDs each contain 700 MBs. The dog can travel at a rate of 18 km/hr. For what range of distances does Bernie have a higher data rate than a 45 Mbps T-3 (Transmission Level 3) line? Ans: A CD can hold 700 MBs. 100 CDs can have 700 * 100 = 70,000 MBs = 70,000 * 8 = 56,0000 Mbits Let's assume d be the distance in km. Time is expressed as d / speed = d / (18/3600) = 200d seconds So the data transfer rate for the dog is 56,0000 / 200d. We were asked to have 56,0000 / 200d > 45 Mbps 200d < 56,0000 / 45 d < 62.22 km For d < 62.22 km, the dog will have a higher data rate than a T3 line. 3. What are the 7 layers in the OSI 7-Layer Reference Model, and (briefly) what is the main purpose of each layer? 1. Physical Layer - transmission of raw bits over a physical channel. 2. Data Link Layer - provide an error-free, point-to-point link to transmit data and control frames between two directly connected nodes. 3. Network Layer - provide a point-to-point link between any two switching nodes (routing, congestion control). 4. Transport Layer - provide a link between any two hosts (connection-oriented or connectionless). 5. Session Layer - manage a conversation between two peer session entities. 6. Presentation Layer - present data in a meaninful format (compress, encode, and convert data). 7. Application Layer - user applications (e-mail, ftp, etc.). 4. List the four layers used in the TCP/IP Protocol Suite: 1. Application Layer - ftp, e-mail, user applications 2. Transport Layer - TCP, UDP 3. Network Layer - IP, ICMP, IGMP 4. Data-Link Layer - Ethernet driver 5. A bit string, 011111111101111111110, needs to be transmitted at the data link layer. What is the string actually transmitted after bit stuffing? Ans: The string to be transmitted is 01111101111011111011110. 6. Suppose that the data frame 1101011011 is to be transmitted. What is the checksummed frame that is actually transmitted, if the divisor is 10011. Ans: M(x)=1101011011 C(x)=10011 r=4 1100001010 _______________ 10011 )11010110110000 10011 ------ 10011 10011 ----- 10110 10011 ----- 10100 10011 ----- 1110 T(x) = 1101011011 1110 7. The ASCII value of the character 'H' is 1001000. What is the binary value after it is to be encoded using an even-parity Hamming code? Ans: 1. Decide # of check bits. m <= 2^r - r - 1 m = 7 => r = 4 2. Calculate the value of the check bits. _ _ 1_001_000 Bit 1 = (1 + 0 + 1 + 0 + 0) mod 2 = 0 Bit 2 = (1 + 0 + 1 + 0 + 0) mod 2 = 0 Bit 4 = (0 + 0 + 1) mod 2 = 1 Bit 8 = (0 + 0 + 0 mod 2 = 0 The encoded value is 00110010000. 8. What is the function of each of the following Berkeley socket system calls: 1. socket - create an endpoint for communication. 2. bind - bind a socket to an address. The address is a pair consisting of an ip-address and a port number. 3. listen - specify the maximum number of outstanding connection requests that can be enqueued; that is, the connection request queue length. 4. accept - wait to accept an incoming connection request. Use by a server to wait for an incoming request. When a request arrives, a new socket is created and the new socket is used for the connection. 5. connect - initiate a connection request. Used by a client to connect to a server. 6. write, sendto - send data using a connection-oriented (TCP), or connectionless (UDP) protocol, respectively. 7. read, recvfrom - read data using a connection-oriented (TCP), or connectionless (UDP) protocol, respectively. 8. close - close a connection. 9. shutdown - terminate a connection in one direction (used to gracefully terminate connections).