280 likes | 360 Views
Process-to-Process Delivery UDP - TCP. USER DATAGRAM PROTOCOL (UDP).
E N D
Process-to-Process Delivery UDP - TCP
USER DATAGRAM PROTOCOL (UDP) The User Datagram Protocol (UDP) is called a connectionless, unreliable transport protocol. It does not add anything to the services of IP except to provide process-to-process communication instead of host-to-host communication.
Note UDP length = Total length – UDP header’s length 23.17
Example The following is a UDP header in hexadecimal format. a. What is the source port number? b. What is the destination port number? c. What is the total length of the user datagram? d. What is the length of the data? e. What is the process?
ExampleContinued Solution a. The source port number is the first four hexadecimal digits (CB84)16 or 52100. b. The destination port number is the second four hexadecimal digits (000D)16 or 13. c. The third four hexadecimal digits (001C)16 define the length of the whole UDP packet as 28 bytes. d. The length of the data is the length of the whole packetminus the length of the header, or 28 – 8 = 20 bytes. e. The client process is the Daytime.
Example A UDP header in hexadecimal format 06 32 00 0D 01 1C E2 17 What is the source port number? What is the destination port number? What is the total length of the user datagram? What is the length of the data? What is the process?
Example 23.2 Figure 23.11 shows the checksum calculation for a very small user datagram with only 7 bytes of data. Because the number of bytes of data is odd, padding is added for checksum calculation. The pseudo header as well as the padding will be dropped when the user datagram is delivered to IP. 23.19
Figure 23.11 Checksum calculation of a simple UDP user datagram
TCP (Transmission control protocol) TCP is a connection-oriented protocol; it creates a virtual connection between two TCPs to send data. In addition, TCP uses flow and error control mechanisms at the transport level. 23.25
Example Suppose a TCP connection is transferring a file of 5,000 bytes. The first byte is numbered 10,001. What are the sequence numbers for each segment if data are sent in five segments, each carrying 1,000 bytes? Solution The following shows the sequence number for each segment:
Example 23.3 The following shows the sequence number for each segment: 23.31
Establishing a TCP Connection B • Three-way handshake to establish connection • Host A sends a SYN (open) to the host B • Host B returns a SYN acknowledgment (SYN ACK) • Host A sends anACK to acknowledge the SYN ACK A SYN Each host tells its ISN to the other host. SYN ACK ACK Data Data 16
Data TCP Header Source port Destination port Sequence number Flags: SYN FIN RST PSH URG ACK Acknowledgment Advertised window HdrLen Flags 0 Checksum Urgent pointer Options (variable) 17
Step 1: A’s Initial SYN Packet A’s port B’s port A’s Initial Sequence Number Flags: SYN FIN RST PSH URG ACK Acknowledgment Advertised window 20 Flags 0 Checksum Urgent pointer Options (variable) A tells B it wants to open a connection… 18
Step 2: B’s SYN-ACK Packet B’s port A’s port B’s Initial Sequence Number Flags: SYN FIN RST PSH URG ACK A’s ISN plus 1 Advertised window 20 Flags 0 Checksum Urgent pointer Options (variable) B tells A it accepts, and is ready to hear the next byte… 19
Step 3: A’s ACK of the SYN-ACK A’s port B’s port Sequence number Flags: SYN FIN RST PSH URG ACK B’s ISN plus 1 Advertised window 20 Flags 0 Checksum Urgent pointer Options (variable) A tells B it wants is okay to start sending 20
Figure 23.18 Connection establishment using three-way handshaking 23.39
Window size • Amount that can be sent without acknowledgment. • Receiver needs to be able to store this amount of data.
Figure 23.22 Sliding window rwnd: receiver window cwnd: congestion window 23.49
Example 23.5 What is the size of the window for host A if the value of rwnd is 3000 bytes and the value of cwnd is 3500 bytes? Solution The size of the window is the smaller of rwnd and cwnd, which is 3000 bytes. 23.52
Example 23.6 The sender has sent bytes up to 202. We assume that cwnd is 20 .The receiver has sent an acknowledgment number of 200 with an rwnd of 9 bytes. The size of the sender window is the minimum of rwnd and cwnd, or 9 bytes. Bytes 200 to 202 are sent, but not acknowledged. Bytes 203 to 208 can be sent without worrying about acknowledgment. Bytes 209 and above cannot be sent. 23.53