Presentation on theme: "Intermediate TCP/IP TCP Operation. 2 TCP/IP Transport Layer The primary duties of the transport layer: Segmentation of upper-layer application data."— Presentation transcript:
Intermediate TCP/IP TCP Operation
2 TCP/IP Transport Layer The primary duties of the transport layer: Segmentation of upper-layer application data Establishment of end-to-end operations Transport of segments from one end host to another end host Flow control provided by sliding windows Reliability with sequence numbers and acknowledgments
3 Layer 4 – TCP and UDP TCP Connection-oriented Reliable Divides outgoing messages into segments Reassembles messages at the destination station Re-sends anything not received Reassembles messages from incoming segments UDP Connectionless Unreliable Transmits messages (called user datagrams) Provides no software checking for message delivery (unreliable) Does not reassemble incoming messages Uses no acknowledgments Provides no flow control
4 TCP Segment Format Number of the calling port Number of the called portUsed to ensure correct sequencing of the arriving data Next expected TCP octet Number of 32-bit words in the header set to zero Control setup and termination of session Number of octets sender is willing to accept Indicates the end of the urgent data Upper layer protocol data
5 UDP Segment Format UDP is the connectionless transport protocol UDP uses no windowing and no acknowledgments Error processing and retransmission must be handled by other protocols (application layer) Protocols that use UDP include: TFTP SNMP DHCP DNS
6 Session 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.
TCP 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)
TCP or UDP Identification The IP Packet has a Protocol field that specifies whether the segment is TCP or UDP. Connection- oriented Connectionless
TCP Reliability TCP 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.
Synchronization: 3-Way Handshake For 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. TCP Header
Only part of the TCP headers are displayed. Packet 1: source: dest: TCP: TCP header TCP: Source port = 1026 TCP: Destination port = 524 TCP: Initial sequence number = TCP: Next expected Seq number= TCP: = SYN TCP: Window = 8192 TCP: Checksum = 1303 (correct) TCP: Maximum segment size = 1460 (TCP Option) Packet 2: source: dest: TCP: TCP header TCP: Source port = 524 TCP: Destination port = 1026 TCP: Initial sequence number = TCP: Next expected Seq number= TCP: Acknowledgment number = TCP: = SYN TCP: Window = TCP: Checksum = D3B7 (correct) TCP: Maximum segment size = 1460 (TCP Option) Packet 3: source: dest: TCP: TCP header TCP: Source port = 1026 TCP: Destination port = 524 TCP: Sequence number = TCP: Next expected Seq number= TCP: Acknowledgment number = TCP: = Acknowledgment TCP: Window = 8760 TCP: Checksum = 493D (correct) TCP: No TCP options
TCP Three-Way Handshake 1.The client sends a SYN message to the server, indicating the client wishes to communicate with the server. Continued…
TCP Three-Way Handshake 2.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…
TCP Three-Way Handshake 3.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.
Simple Windowing (1) 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. TCP Header
Simple 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 acknowledgments The 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.
Simple 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 reduced If more data can be handled, acceptable window size is increased This is known as a Stop-and-Wait windowing protocol.
Sequencing Numbers The 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 transmitted TCP 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.
Positive 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.
UDP Operation UDP 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.
Port Numbers (TCP and UDP)
23 Port Numbers Port 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)
Application software developers have agreed to use the well-known port numbers that are defined in RFC For example, any conversation bound for an Telnet application uses the standard port number 23. TCP Header Port Numbers
Conversations 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. Standard Port Numbers
The 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,023 The 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,151 The Dynamic and/or Private Ports are those from 49,152 through 65,535
End 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. TCP Header Port Numbers
Notice 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) TCP Header
1031 Second http session from the between the same client and server. Same destination port, but different source port to uniquely identify this web session http to Dest. Port = 80 Send packets to web server application This example shows two separate browser windows to the same URL. TCP/IP uses source port numbers to know which information goes to which window.
What makes each connection unique? Connection defined by the pair of numbers: Source IP address, source port Destination IP address, destination port Different connections can use the same destination port on server host as long as the source ports or source IP addresses are different.