cs349 Lecture Notes Fall 2000 Week 2, Tuesday Truncated office hours For today you should have read P&D Sections 1.2 and 1.3 and written answers for questions 15, 23, 25 and the following: 6) As clearly and concisely as you can, explain what a socket is. 7) As clearly and concisely as you can, explain what a port is. For Friday you should start Homework 3, which is due next Tuesday. Also, read Chapter 2, starting with a high-level pass. Section 1.2 Layering and protocols ----------- (quote from page 30) "The idea of abstraction is to define a unifying model that can capture some important aspect of the system, encapsulate the model in an object that provides an interface that can be manipulated by other components of the system, and hide the details of how the object is implemented from the users of the object." To capture an aspect means that the model and the real world will agree with respect to that aspect. An object is an entity that provides a set of well-defined services. It may not be an object in the sense of a Java object (a set of data fields with a set of operations). It might look more like a bunch of system calls that you invoke, and that manipulate data somewhere in the kernel that you don't know much about. But that's an object. Transport protocols ------------------- http is an application-level protocol that determines a coding for the message "send me the file named fred.html" The message looks like GET http:rocky.wellesley.edu/fred.html HTTP/1.1 In theory, your browser could invoke the network card's device driver directly and put these bits on the wire. But: 1) when they got to the first internal node, how would it know what to do with them? 2) assuming it somehow got to the destination, how would the recipient know how to interpret it? 3) assuming the recipient somehow knew what it meant, how would it know where to send the reply? It would be infeasible for every network application to handle these problems themselves. That's why we need transport protocols. The fundamental protocol on the Internet is called IP (internet protocol). IP defines a global address space such that every node in the network has a unique address. When you transmit a message using IP, you attach a header to the message that is like an envelope. The header contains the destination address and the source (return) address. That handles (1) and (3). TCP sits between IP and the application and provides and additional layer of abstraction. Specifically, it defines The concept of a port. A port is like a mailbox. A process can allocate a port (by creating a socket and connecting it to the port) and use it to send and receive data. Most network servers use a pre-defined, well-known port number. For example, web servers connect to port 80 and listen for incoming requests from clients (browsers). Web clients usually allocate a port arbitrarily from the range of numbers that have not been preallocated. A TCP/IP header is like an envelope on a packet. It contains: source IP address dest IP address source port # dest port # Internal nodes use the addresses to direct the packet to its destination. The destination host uses the dest port # to know which process to hand the packet to. The recipient process uses the contents of the packet to figure out what to do, and the source info to know who to reply to. The protocol stack ------------------ So the usual picture for Internet traffic is something like Application protocol (HTTP in the example) Process-to-process protocol (TCP) Host-to-host protocol (IP) Network protocol (Chapter 2) Two ways to think of this stack: 1) a set of nested system calls. To send a message, the application invokes system calls like the ones in the book and the homework. These system calls are implemented by invoking procedures provided by TCP. The TCP methods are implemented by invoking procedures provided by IP. The IP methods are implemented by invoking procedures provided by the network device driver. 2) a set of nested envelopes The data from the application gets wrapped up in an envelope that identifies the sending and receiving processes (ports), the TCP header. The TCP packet gets wrapped up in an envelope that contains the destination and source machines' IP addresses, the IP header. The network level might wrap the IP packet inside another envelope containing, for example, the Ethernet address of the sender. Potential source of confusion: In the first point of view, Ethernet is encapsulated in IP, which is encapsulated in TCP, which is encapsulated the application level. In the second point of view, the actual nesting of packets within packets, it's the other way around. Chapter 2 --------- Overview: fundamental problem is getting data across a single link. 2.1 -- 2.5 talk about the general mechanisms used by network-level protocols 2.6 -- 2.8 look at network-level protocols for three link structures bus-like (Ethernet) token-ring (FDDI) wireless (no well-known names yet) 2.9 talks about the hardware-level interface (network cards and device drivers) What are the high-level concepts we want to get out of this chapter? 1) Encoding, framing, error detection/correction and reliable delivery, media access control. In each case there is a range of possible solutions. The best choice is determined by the characteristics of the network. 2) What are the characteristics of the example networks that drive their design? Did the engineers make appropriate choices? Encoding -------- Let's talk about guns. How can you send a signal with a gun? 1) x-gun salute, where x is the message. In effect, this is a unary code. 2) two, distinguishable guns? different frequencies, amplitudes? 3) synchonous codes -- sender and receiver share a clock during each clock cycle, there either is or is not a gunshot Framing ------- How do sender and receiver agree on packet boundaries? Error detection --------------- How does the network detect bit and burst errors? Reliable transmission --------------------- How does the network deal with errors when it finds them?