2TCP/IP Transport Layer The primary duties of the transport layer:Segmentation of upper-layer application dataEstablishment of end-to-end operationsTransport of segments from one end host to another end hostFlow control provided by sliding windowsReliability with sequence numbers and acknowledgments
3Layer 4 – TCP and UDP TCP Connection-oriented Reliable Divides outgoing messages into segmentsReassembles messages at the destination stationRe-sends anything not receivedReassembles messages from incoming segmentsUDPConnectionlessUnreliableTransmits messages (called user datagrams)Provides no software checking for message delivery (unreliable)Does not reassemble incoming messagesUses no acknowledgmentsProvides no flow control
4TCP Segment Format Number of the calling port Number of the called portUsed to ensure correct sequencing of the arriving dataNext expected TCP octetNumber of 32-bit words in the headerNumber of octets sender is willing to acceptControl setup and termination of sessionset to zeroIndicates the end of the urgent dataUpper layer protocol data
5UDP Segment Format UDP is the connectionless transport protocol UDP uses no windowing and no acknowledgmentsError processing and retransmission must be handled by other protocols (application layer)Protocols that use UDP include:TFTP SNMP DHCP DNS
6Session Maintanance - Flow Control and Windowing Window size determines the amount of data that you can transmit before receiving an acknowledgment.Expectational acknowledgment means that the acknowledgment number refers to the octet that is next expected.Sliding window refers to the fact that the window size is negotiated dynamically during the TCP session.If the source receives no acknowledgment, it knows to retransmit at a slower rate.
7TCP Operation IP provides best-effort delivery. The transport layer (TCP) is responsible for reliability and flow control from source to destination.This is accomplished using:Sliding windows (flow control)Sequencing numbers and acknowledgments (reliability)Synchronization (establish a virtual circuit)
8TCP or UDP Identification The IP Packet has a Protocol field that specifies whether the segment is TCP or UDP.Connection-orientedConnectionless
9TCP ReliabilityTCP re-sends anything that is not received and supplies a virtual circuit between end-user applications.The advantage of TCP is that it provides guaranteed delivery of the segments.
10Synchronization: 3-Way Handshake TCP HeaderFor a connection to be established, the two end stations must synchronize on each other's initial TCP sequence numbers (ISNs).Sequence numbers are used to track the order of packets and to ensure that no packets are lost in transmission.The initial sequence number is the starting number used when a TCP connection is established.Exchanging beginning sequence numbers during the connection sequence ensures that lost data can be recovered.
11Only part of the TCP headers are displayed. Packet 1: source: dest:TCP: TCP header -----TCP: Source port = 1026TCP: Destination port = 524TCP: Initial sequence number = 12952TCP: Next expected Seq number= 12953TCP: = SYNTCP: Window = 8192TCP: Checksum = 1303 (correct)TCP: Maximum segment size = 1460 (TCP Option)Packet 2: source: dest:TCP: TCP header -----TCP: Source port = 524TCP: Destination port = 1026TCP: Initial sequence number =TCP: Next expected Seq number=TCP: Acknowledgment number = 12953TCP: = SYNTCP: Window = 32768TCP: Checksum = D3B7 (correct)TCP: Maximum segment size = 1460 (TCP Option)Packet 3: source: dest:TCP: TCP header -----TCP: Source port = 1026TCP: Destination port = 524TCP: Sequence number = 12953TCP: Next expected Seq number= 12953TCP: Acknowledgment number =TCP: = AcknowledgmentTCP: Window = 8760TCP: Checksum = 493D (correct)TCP: No TCP optionsOnly part of the TCP headers are displayed.
12TCP Three-Way Handshake The client sends a SYN message to the server, indicating the client wishes to communicate with the server.Continued…
13TCP Three-Way Handshake The server responds to the client with an ACK message, and a SYN message.Here, the server places the client into the server’s half-open queue, where it waits for the three-way handshake to complete.Continued…
14TCP Three-Way Handshake The client responds with an ACK message, completing the handshake.Now, the server moves the client from the half-open queue, freeing resources for new incoming connections to the server.
15Simple Windowing (1) TCP Header TCP is responsible for breaking data into segments.With a window size of 1, each segment carries only one byte of data and must be acknowledged before another segment is transmitted.This results in inefficient host use of bandwidth.The purpose of windowing is to improve flow control and reliability.Unfortunately, with a window size of 1, you see a very inefficient use of bandwidth.
16Simple Windowing (2)TCP uses a window size, number of bytes, that the receiver is willing to accept, and is usually controlled by the receiving process.TCP uses expectational acknowledgmentsThe acknowledgment number refers to the next byte that the sender of the acknowledgement expects to receive.A larger window size allows more data to be transmitted pending acknowledgment.The sequence number being sent identifies the first byte of data in that segment.
17Simple Windowing (3)TCP provides full-duplex service, which means data can be flowing in each direction, independent of the other direction.Window sizes, sequence numbers and acknowledgment numbers are independent of each other’s data flow.Receiver sends acceptable window size to sender during each segment transmission (flow control)If too much data being sent, acceptable window size is reducedIf more data can be handled, acceptable window size is increasedThis is known as a Stop-and-Wait windowing protocol.
18Sequencing NumbersThe data segments being transmitted must be reassembled once all the data is received.No guarantee that the data will arrive in the order it was transmittedTCP applies sequence numbers to the data segments.Sequencing numbers indicate to the destination device the correct order in which to put the bytes when they are received.These sequencing numbers also act as reference numbers so that the receiver will know if it has received all of the data.They also identify the missing data pieces to the sender so it can retransmit the missing data.
19Positive Acknowledgment and Retransmission (PAR) PAR: The source sends a packet, starts a timer, and waits for an acknowledgment before sending the next packet.If the timer expires before the source receives an acknowledgment, the source retransmits the packet and starts the timer over again.TCP uses expectational acknowledgments in which the acknowledgment number refers to the next octet that is expected.
20UDP OperationUDP does not use windowing or acknowledgments so application layer protocols must provide error detection.The Source Port field is an optional field used only if information needs to return to the sending host.
23Port NumbersPort nos. are used to keep track of different conversations that cross the network at the same time.Port nos. allow for multiplexing of upper-layer conversations.Port nos. are used as source and destination addresses in the TCP segment.Port nos. below 1024 are considered well-known.Port nos. above 1024 are dynamically assigned.Registered port nos. are for vendor-specific applications (Most are above 1024)
24Port NumbersTCP HeaderApplication software developers have agreed to use the well-known port numbers that are defined in RFC 1700.For example, any conversation bound for an Telnet application uses the standard port number 23.
25Standard Port NumbersConversations that do not involve an application with a well-known port number are, instead, assigned port numbers that are randomly selected from within a specific range.These port numbers are used as source and destination addresses in the TCP segment.Some ports are reserved in both TCP and UDP, although applications might not be written to support them.
26The Dynamic and/or Private Ports are those from 49,152 through 65,535 Standard Port NumbersThe Well-Known Ports are assigned by the IANA and on most systems can only be used by system (or root) processes or by programs executed by privileged users.Ports 0 – 1,023The Registered Ports are listed by the IANA and on most systems can be used by ordinary user processes or programs executed by ordinary users. The IANA registers uses of these ports as a convenience to the community.Ports 1,024 – 49,151The Dynamic and/or Private Ports are those from 49,152 through 65,535
27Port NumbersTCP HeaderEnd systems use port numbers to select the proper application.Originating source port numbers, usually a value larger than 1023, are dynamically assigned by the source host.
28TCP HeaderNotice the difference in how source and destination port numbers are used with clients and servers:Client:Destination Port = 23 (telnet)Source Port = 1028 (dynamically assigned)Server:Destination Port = 1028 (source port of client)Source Port = 23 (telnet)
29Second http session from the between the same client and server Second http session from the between the same client and server. Same destination port, but different source port to uniquely identify this web session.Dest. Port = 80 Send packets to web server applicationhttp toDest. Port = 80 Send packets to web server applicationhttp to103080103180This example shows two separate browser windows to the same URL. TCP/IP uses source port numbers to know which information goes to which window.
30What makes each connection unique? Connection defined by the pair of numbers:Source IP address, source portDestination IP address, destination portDifferent connections can use the same destination port on server host as long as the source ports or source IP addresses are different.