C SC 481.20 Lecture 6: Introduction and Connectionless Transport
major resource: Computer Networking (4th Edition),
Kurose and Ross, Addison Wesley, 2008
[ previous
| schedule
| next ]
Basic Transport Services
Transport layer provides, minimally, process-to-process (e.g. client application-to-server application) communication.
For Internet communication, this involves:
(a) getting the packet from the sender’s machine to the receiver’s machine. IP, the network layer, does this.
(b) once packet arrives at receiver, delivering it to the correct process – TCP and UDP both do this.
- IP provides unreliable service: it routes datagrams through the network core.
- Transport layer packet is called a segment.
- The only “value added” by UDP is delivery to the process if the IP datagram arrives at receiver.
- TCP, in addition to delivery, provides a substantial added value: reliable transport service.
Service: Reliable Delivery
- For Internet, this is provided by TCP, because the underlying network layer, IP, does not provide it.
- Reliability requires complete, in-order, error-free
delivery by receiver transport service to application
- Complexity of protocol for reliable delivery depends on underlying assumptions. The fewer the assumptions, the more complex. Several are explained in detail below.
Service: Deliver to correct process once datagram arrives
Transport Header contains two 16-bit fields (both TCP and UDP contain these, at byte 0 and byte 2):
(a) source port #
(b) destination port #
Scenario 1: simple exchange between client and server.
- server is up and running and listening on port X.
- client initiates contact, sends segment with destination port X, source port Y (selected automatically from pool of unused ports)
- segment arrives at server machine, destination port is read, and delivered to the process running on port X (the server process).
- server formulates response, sends segment with destination port Y, source port X.
- segment arrives at client machine, destination port is read, and delivered to the process running on port Y (the client process).
- client formulates response, sends segment with destination port X, source port Y.
- etc.
Scenario 2: two clients on same machine to same server (e.g. two browser windows).
- server is up and running and listening on port X.
- client1 initiates contact, sends segment with destination port X, source port Y1 (selected automatically from pool of unused ports).
- client2 initiates contact, sends segment with destination port X, source port Y2 (selected automatically from pool of unused ports).
- segment arrives at server machine, destination port is read, and delivered to the process running on port X (the server process). Segment could be from either client1 or client2.
- server formulates response, sends segment with destination port Y1 or Y2 (depending on source port of incoming segment), source port X.
- segment arrives at client machine, destination port is read, and delivered to the process running on whichever port is specified in source port field.
- etc.
Scenario 3: two clients on different machines to same server.
- server is up and running and listening on port X.
- client1 initiates contact, sends segment with destination port X, source port Y (selected automatically from pool of unused ports).
- client2 initiates contact, sends segment with destination port X, source port Y (selects same port number as client1!).
- segment arrives at server machine, destination port is read, and delivered to the process running on port X (the server process). Segment could be from either client1 or client2. Q: How does server know which one, since both have source port Y? A: looks at IP address.
- server formulates response, sends segment with destination port Y, source port X.
- etc.
The lesson for delivering to correct process: Combination of destination and source port #s will be unique,
except if two clients connect to same server from different IP addresses through same source port#. In this case, differentiate based on IP address.
UDP – User Datagram Protocol
Datagram service. Used by DNS, SNMP (Simple Network Management Protocol), some A/V protocols, and a few others.
Motivation: if best-effort ("I'll try my best, but make no guarantees.") delivery is good enough, then UDP is fast (no connection setup) and cheap. Also helps if sender and receiver operate at similar rates (to avoid flooding).
Segment Structure:
- source port (16 bits)
- destination port(16 bits)
- segment length(16 bits)
- checksum(16 bits)
- payload (variable length)
Comments about the segment structure
- Fields 1 and 2 already covered.
- Field 3 is segment length, including header, in bytes.
- Field 4 checksum is used so receiver can determine if segment was received error-free.
- The 16-bit checksum is calculated by taking the sum of all 16-bit portions of the segment, then computing the one’s complement of that result (e.g. flip the bits). It is actually a little more complicated than that, see RFC 768 for details. If checksum field is all zero’s, receiver assumes checksum is not being used.
- If checksum is being used, receiver calculates sum of all 16-bit portions of segment, including the checksum itself. The result will be all 1’s (see next bullet), unless an error occurred.
- Since original checksum is complement of sum of the rest, including it into the sum on the receiver's end will produce a 1 in each bit position. To use a 4-bit example, if sum of rest is 0101, checksum will be 1010. Receiver calculates sum of the rest plus checksum, or 0101 + 1010 = 1111.
[ C
SC 481 | Peter
Sanderson | Math Sciences server
| Math Sciences home page
| Otterbein ]
Last updated:
Peter Sanderson (PSanderson@otterbein.edu)