Download presentation
Presentation is loading. Please wait.
Published byBeverley Lyons Modified over 8 years ago
1
Spring 2006 CPE 0907532: Transport Layer Overview2-1 Special Topics in Computer Engineering The Transport Layer in the Internet: Overview Some of these Slides are Based on Slides by Kurose and Ross Prepared for Sections 3.1, 3.2, 3.3.1, 3.4.1, 3.5.1, 3.5.4 of the Book Computer Networking: A Top Down Approach Featuring the Internet
2
Spring 2006 CPE 0907532: Transport Layer Overview2-2 Transport services and protocols provide logical communication between app processes running on different hosts transport protocols run in end systems send side: breaks app messages into segments, passes to network layer rcv side: reassembles segments into messages, passes to app layer more than one transport protocol available to apps Internet: TCP and UDP application transport network data link physical application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical logical end-end transport
3
Spring 2006 CPE 0907532: Transport Layer Overview2-3 Internet transport-layer protocols reliable, in-order delivery (TCP) congestion control flow control connection setup unreliable, unordered delivery: UDP no-frills extension of “best-effort” IP application transport network data link physical application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical logical end-end transport
4
Spring 2006 CPE 0907532: Transport Layer Overview2-4 Transport layer addressing Communications endpoint addressed by: IP address (32 bit) in IP Header Port number (16 bit) in TP Header 1 Transport protocol (TCP or UDP) in IP Header 1 TP => Transport Protocol (UDP or TCP)
5
Spring 2006 CPE 0907532: Transport Layer Overview2-5 Some standard services and port numbers PORT NUMBERS (last updated 24 February 2006) http://www.iana.org/assignments/port-numbers
6
Spring 2006 CPE 0907532: Transport Layer Overview2-6 Socket API (Application Programming Interface) introduced in BSD4.1 UNIX, 1981BSD explicitly created, used, released by apps client/server paradigm two types of transport service via socket API: unreliable datagram reliable, byte stream- oriented a host-local, application-created, OS-controlled interface (a “door”) into which application process can both send and receive messages to/from another application process socket
7
Spring 2006 CPE 0907532: Transport Layer Overview2-7 Example: Socket-programming using TCP Socket: a door between application process and end- end-transport protocol (UCP or TCP) TCP service: reliable transfer of bytes from one process to another process TCP with buffers, variables socket controlled by application developer controlled by operating system host or server process TCP with buffers, variables socket controlled by application developer controlled by operating system host or server internet
8
Spring 2006 CPE 0907532: Transport Layer Overview2-8 Socket programming with TCP Client must contact server server process must first be running server must have created socket (door) that welcomes client’s contact Client contacts server by: creating client-local TCP socket specifying IP address, port number of server process When client creates socket: client TCP establishes connection to server TCP When contacted by client, server TCP creates new socket for server process to communicate with client allows server to talk with multiple clients source port numbers used to distinguish clients TCP provides reliable, in-order transfer of bytes (“pipe”) between client and server application viewpoint
9
Spring 2006 CPE 0907532: Transport Layer Overview2-9 3.2 Multiplexing/demultiplexing application transport network link physical P1 application transport network link physical application transport network link physical P2 P3 P4 P1 host 1 host 2 host 3 = process= socket delivering received segments to correct socket Demultiplexing at rcv host: gathering data from multiple sockets, enveloping data with header (later used for demultiplexing) Multiplexing at send host:
10
Spring 2006 CPE 0907532: Transport Layer Overview2-10 How demultiplexing works host receives IP datagrams each datagram has source IP address, destination IP address each datagram carries 1 transport-layer segment each segment has source, destination port number host uses IP addresses & port numbers to direct segment to appropriate socket source port #dest port # 32 bits application data (message) other header fields TCP/UDP segment format
11
Spring 2006 CPE 0907532: Transport Layer Overview2-11 Connectionless demultiplexing Create sockets with port numbers: DatagramSocket mySocket1 = new DatagramSocket(12534); DatagramSocket mySocket2 = new DatagramSocket(12535); UDP socket identified by two-tuple: ( dest IP address, dest port number) When host receives UDP segment: checks destination port number in segment directs UDP segment to socket with that port number IP datagrams with different source IP addresses and/or source port numbers directed to same socket
12
Spring 2006 CPE 0907532: Transport Layer Overview2-12 Connectionless demux (cont) DatagramSocket serverSocket = new DatagramSocket(6428); Client IP:B P2 client IP: A P1 P3 server IP: C SP: 6428 DP: 9157 SP: 9157 DP: 6428 SP: 6428 DP: 5775 SP: 5775 DP: 6428 SP provides “return address”
13
Spring 2006 CPE 0907532: Transport Layer Overview2-13 Connection-oriented demux TCP socket identified by 4-tuple: source IP address source port number dest IP address dest port number recv host uses all four values to direct segment to appropriate socket Server host may support many simultaneous TCP sockets: each socket identified by its own 4-tuple Web servers have different sockets for each connecting client non-persistent HTTP will have different socket for each request
14
Spring 2006 CPE 0907532: Transport Layer Overview2-14 Connection-oriented demux (cont) Client IP:B P1 client IP: A P1P2P4 server IP: C SP: 9157 DP: 80 SP: 9157 DP: 80 P5P6P3 D-IP:C S-IP: A D-IP:C S-IP: B SP: 5775 DP: 80 D-IP:C S-IP: B
15
Spring 2006 CPE 0907532: Transport Layer Overview2-15 Connection-oriented demux: Threaded Web Server Client IP:B P1 client IP: A P1P2 server IP: C SP: 9157 DP: 80 SP: 9157 DP: 80 P4 P3 D-IP:C S-IP: A D-IP:C S-IP: B SP: 5775 DP: 80 D-IP:C S-IP: B
16
Spring 2006 CPE 0907532: Transport Layer Overview2-16 UDP: User Datagram Protocol [RFC 768] “no frills,” “bare bones” Internet transport protocol “best effort” service, UDP segments may be: lost delivered out of order to the application connectionless: no handshaking between UDP sender, receiver each UDP segment handled independently of others Why is there a UDP? no connection establishment (which can add delay) simple: no connection state at sender, receiver small segment header no congestion control: UDP can blast away as fast as desired
17
Spring 2006 CPE 0907532: Transport Layer Overview2-17 UDP Port Management Source (client) Obtains a free port number Specifies “IP:port” of destination (server) Destination Receives datagram Sends datagram to destination “IP:port” Can send replies to source “IP:port”
18
Spring 2006 CPE 0907532: Transport Layer Overview2-18 UDP: more often used for streaming multimedia apps loss tolerant rate sensitive other UDP uses (why?): DNS DNS SNMP SNMP reliable transfer over UDP: add reliability at application layer application-specific error recover! source port #dest port # 32 bits Application data (message) UDP segment format length checksum Length, in bytes of UDP segment, including header
19
Spring 2006 CPE 0907532: Transport Layer Overview2-19 UDP checksum Sender: treat segment contents as sequence of 16-bit integers checksum: addition (1’s complement sum) of segment contents sender puts checksum value into UDP checksum field Receiver: compute checksum of received segment check if computed checksum equals checksum field value: NO - error detected YES - no error detected. But may be errors nonetheless? More later Goal: detect “errors” (e.g., flipped bits) in transmitted segment
20
Spring 2006 CPE 0907532: Transport Layer Overview2-20 Transmission Control Protocol (TCP) Connection-oriented service Full-duplex communication Stream interface (no message boundary !) Stream divided into segments for transmission Each segment encapsulated in IP datagram Uses protocol ports to identify applications
21
Spring 2006 CPE 0907532: Transport Layer Overview2-21 TCP Port Management When a connection is established Source (client) Obtains a free port number Specifies IP:port of destination (server) Destination Receives connection request Sends data to destination IP:port The 4-tuple (source IP:port, destination IP:port) identifies where data goes (i.e. identifies the socket used by the application)
22
Spring 2006 CPE 0907532: Transport Layer Overview2-22 TCP Segment Sequence number specifies where in stream data belongs Few segments contain options
23
Spring 2006 CPE 0907532: Transport Layer Overview2-23 TCP Segment Format Segment divided into two parts Header Payload area (zero or more bytes of data) Header contains Protocol port numbers to identify Sending application Receiving application Bits to specify items such as SYN FIN ACK Fields for window advertisement, acknowledgment, etc.
24
Spring 2006 CPE 0907532: Transport Layer Overview2-24 Reliability in an Unreliable World IP offers best-effort (unreliable) delivery TCP uses IP TCP provides completely reliable transfer How is this possible? How can TCP realize: Reliable connection startup? Reliable data transmission? Graceful connection shutdown?
25
Spring 2006 CPE 0907532: Transport Layer Overview2-25 Reliable Data Transmission Positive acknowledgment Receiver returns short message when data arrives Called acknowledgment Retransmission Sender starts timer whenever message is transmitted If timer expires before acknowledgment arrives, sender retransmits message
26
Spring 2006 CPE 0907532: Transport Layer Overview2-26 TCP seq. #’s and ACKs Seq. #’s: byte stream “number” of first byte in segment’s data ACKs: seq # of next byte expected from other side cumulative ACK Q: how receiver handles out-of-order segments A: TCP spec doesn’t say, - up to implementer Host A Host B Seq=42, ACK=79, data = ‘C’ Seq=79, ACK=43, data = ‘C’ Seq=43, ACK=80 User types ‘C’ host ACKs receipt of echoed ‘C’ host ACKs receipt of ‘C’, echoes back ‘C’ time simple telnet scenariotelnet
27
Spring 2006 CPE 0907532: Transport Layer Overview2-27 Timing Problem! The delay required for data to reach a destination and an acknowledgment to return depends on traffic in the internet as well as the distance to the destination. Because it allows multiple application programs to communicate with multiple destinations concurrently, TCP must handle a variety of delays that can change rapidly. How does TCP handle this.....
28
Spring 2006 CPE 0907532: Transport Layer Overview2-28 Solving Timing Problem Keep estimate of round trip time on each connection Use current estimate to set retransmission timer Known as adaptive retransmission Key to TCP’s success
29
Spring 2006 CPE 0907532: Transport Layer Overview2-29 TCP Flow Control Receiver Advertises available buffer space Called window Sender Can send up to entire window before ACK arrives Each acknowledgment carries new window information Called window advertisement Can be zero (called closed window) Interpretation: I have received up through X, and can take Y more octets
30
Spring 2006 CPE 0907532: Transport Layer Overview2-30 TCP Flow Control receiver: explicitly informs sender of (dynamically changing) amount of free buffer space RcvWindow field in TCP segment sender: keeps the amount of transmitted, unACKed data less than most recently received RcvWindow sender won’t overrun receiver’s buffers by transmitting too much, too fast flow control receiver buffering RcvBuffer = size of TCP Receive Buffer RcvWindow = amount of spare room in Buffer
31
Spring 2006 CPE 0907532: Transport Layer Overview2-31 Why Startup/ Shutdown (of a TCP Connection) Difficult ? Segments can be Lost Duplicated Delayed Delivered out of order Either side can crash Either side can reboot Need to avoid duplicate ‘‘shutdown’’ message from affecting later connection
32
Spring 2006 CPE 0907532: Transport Layer Overview2-32 TCP’s Startup/ Shutdown Solution Uses three-message exchange known as 3- way handshake Necessary and sufficient for Unambiguous, reliable startup Unambiguous, graceful shutdown SYN used for startup, FIN used for shutdown
33
Spring 2006 CPE 0907532: Transport Layer Overview2-33 TCP Connection Management (OPEN) client SYN server SYN / ACK ACK opening established
34
Spring 2006 CPE 0907532: Transport Layer Overview2-34 TCP Connection Management (CLOSE) client FIN server ACK FIN closing closed timed wait closed
35
Spring 2006 2-35 TCP Connection Management (cont) TCP client lifecycle TCP server lifecycle send / receive messages
36
Spring 2006 CPE 0907532: Transport Layer Overview2-36 Transport Protocol Summary Transport protocols fit between applications and Internet Protocol Two transport protocols in TCP/IP suite User Datagram Protocol (UDP) Transmission Control Protocol (TCP) UDP Unreliable Message-oriented interface TCP Major transport protocol used in Internet Complete reliability Stream-oriented interface Uses adaptive retransmission
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.