ProcesstoProcess Delivery UDP TCP USER DATAGRAM PROTOCOL UDP

  • Slides: 28
Download presentation
Process-to-Process Delivery UDP - TCP

Process-to-Process Delivery UDP - TCP

USER DATAGRAM PROTOCOL (UDP) The User Datagram Protocol (UDP) is called a connectionless, unreliable

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.

23. 13 Table 23. 1 Well-known ports used with UDP

23. 13 Table 23. 1 Well-known ports used with UDP

Figure 23. 9 User datagram format

Figure 23. 9 User datagram format

23. 17 Note UDP length = Total length – UDP header’s length

23. 17 Note UDP length = Total length – UDP header’s length

Example The following is a UDP header in hexadecimal format. a. What is the

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?

Example Continued Solution a. The source port number is the first four hexadecimal digits

Example Continued Solution a. The source port number is the first four hexadecimal digits (CB 84)16 or 52100. b. The destination port number is the second four hexadecimal digits (000 D)16 or 13. c. The third four hexadecimal digits (001 C)16 define the length of the whole UDP packet as 28 bytes. d. The length of the data is the length of the whole packet minus 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 0 D 01 1

Example A UDP header in hexadecimal format 06 32 00 0 D 01 1 C E 2 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?

Figure 23. 10 Pseudo header for checksum calculation 23. 18

Figure 23. 10 Pseudo header for checksum calculation 23. 18

Example 23. 2 Figure 23. 11 shows the checksum calculation for a very small

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

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

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

23. 26 Table 23. 2 Well-known ports used by TCP

23. 26 Table 23. 2 Well-known ports used by TCP

Example Suppose a TCP connection is transferring a file of 5, 000 bytes. The

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

Example 23. 3 The following shows the sequence number for each segment: 23. 31

Establishing a TCP Connection A B SYN C SYN A K ACK Each host

Establishing a TCP Connection A B SYN C SYN A K ACK Each host tells its ISN to the other host. Data • 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 an ACK to acknowledge the SYN ACK 16

TCP Header Source port Destination port Sequence number Flags: SYN FIN RST PSH URG

TCP Header Source port Destination port Sequence number Flags: SYN FIN RST PSH URG ACK Acknowledgment Hdr. Len 0 Flags Advertised window Checksum Urgent pointer Options (variable) Data 17

Step 1: A’s Initial SYN Packet A’s port B’s port A’s Initial Sequence Number

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 20 Flags 0 Checksum Advertised window 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:

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 20 Flags 0 Checksum Advertised window 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:

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 20 Flags 0 Checksum Advertised window 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

Figure 23. 18 Connection establishment using three-way handshaking 23. 39

 • Window size –Amount that can be sent without acknowledgment. –Receiver needs to

• 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 23. 49 rwnd: receiver window cwnd: congestion window

Figure 23. 22 Sliding window 23. 49 rwnd: receiver window cwnd: congestion window

Example 23. 5 What is the size of the window for host A if

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

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

Figure 23. 23 Example 23. 6 23. 54

Figure 23. 23 Example 23. 6 23. 54