Presentation is loading. Please wait.

Presentation is loading. Please wait.

Process-to-Process Delivery, TCP and UDP protocols

Similar presentations


Presentation on theme: "Process-to-Process Delivery, TCP and UDP protocols"— Presentation transcript:

1 Process-to-Process Delivery, TCP and UDP protocols
King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science Department ICS 343 Fundamentals of Computer Networks Process-to-Process Delivery, TCP and UDP protocols These slides are based on: Chapter 23 Data Communications and Networking, 4th Edition

2 Objectives Discuss Port and Socket Addresses
Learn Multiplexions and Demultiplexing Explore Connectionless Versus Connection-Oriented Service Discuss Reliable Versus Unreliable

3 Types of Deliveries Data link layer is responsible for delivery of frames between two neighboring nodes over a link  Node-to-node delivery Network layer is responsible for delivery of datagrams between two hosts  host-to-host delivery Real communication takes place between two processes (application programs). So, we need process-to-process delivery Transport layer is responsible for process-to-process delivery, the delivery of a packet, part of a message, from one process to another.

4 Port Numbers

5 Sockets Combination of an IP address and a port number is called a socket address. Client socket address defines the client process uniquely just as the server socket address defines the server process uniquely. Transport layer protocol needs a pair of socket addresses: the client socket address and server socket address.

6 Figure 23.6 Multiplexing and demultiplexing

7 Connection Oriented and Connectionless
Connectionless service Packets are sent from one party to another with no need for connection establishment or connection release. Packets are not numbered; they may be delayed, lost, or arrive out of sequence. No acknowledgement. UDP [User Datagram Protocol] Connection-oriented service Connection is first established between the sender and the receiver Data are transferred At the end, the connection is released. TCP [Transmission Control Protocol]

8 Figure 23.8 Position of UDP and TCP in TCP/IP suite

9 UDP UDP performs very limited error checking.
Very small protocol with a minimum of overhead. If a process wants to send a small message and does not care much about reliability, it can use UDP Sending a small message using UDP takes much less interaction between the sender and receiver than using TCP. UDP is a convenient protocol for multimedia and multicasting applications. UDP is a connectionless, unreliable protocol that has no flow and error control. It uses port numbers to multiplex data from the application layer.

10 Figure 23.9 User datagram format
UDP packets, called user datagrams, have a fixed-size header of 8 bytes. Source port number: Port number used by process running source host; 16 bits [0 to 65535] Destination port number: Port number used by process running destination host; 16 bits Length: 16-bit field; Total length of user datagram header plus data. Checksum: Used to detect errors over the entire user datagram (header plus data) Its optional to do checksum. If not done, put the entries as all 0s. Also checks the unchanged fields, including the IP header part [plus UDP header and UDP payload (data coming from application layer)].

11 Figure 23.10 Pseudoheader for checksum calculation

12 Figure Queues in UDP

13 Topics discussed in this section:
TCP 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. Topics discussed in this section: TCP Services TCP Features Segment A TCP Connection Flow Control Error Control

14 TCP TCP is a connection-oriented protocol
TCP creates a virtual connection between two TCPs to send data TCP uses flow and error control mechanisms at the transport level

15 Stream Delivery Stream Delivery Service
TCP, unlike UDP, is a stream-oriented protocol. UDP adds its own header to chunk of data, which is now called a user datagram, and delivers it to IP for transmission. The process may deliver several chunks of data to the UDP, but UDP treats each chunk independently without seeing any connection between them. TCP allows the sending process to deliver data as a stream of bytes and receiving process to obtain data as a stream of bytes. TCP creates an environment in which the two processes seem to be connected by an imaginary “tube” that carries their data across the Internet.

16 Sending and Receiving Buffers
Because the sending and receiving processes may not produce and consume data at the same speed, TCP needs buffers for storage. There are two buffers, the sending buffer and the receiving buffer, for each direction. Buffers are of hundreds or thousands of bytes, depending on implementation and not of same size. Byte locations are recycled and made available for further use.

17 TCP Segments The IP layer, as a service provider for TCP, needs to send data in packets, not as a stream of bytes. At the transport layer, TCP groups a number of bytes together into a packet called a segment. TCP adds a header to each segment (for control purposes) and delivers the segment to the IP layer for transmission. The segments are encapsulated in an IP datagram and transmitted. Segments are not necessarily the same size.

18 Acknowledgement number
Numbering bytes Sequence number and acknowledgement number Byte number: When TCP receives bytes of data from the process and stores them in the sending buffer; it numbers them. Numbering does not necessarily start from 0; it starts with a randomly generated number between 0 to 232 – 1. If random number happens to be 1057 and total data to be sent are 6000 bytes, the bytes are numbered from 1057 to 7056. Sequence number TCP assigns a sequence number to each segment that is being sent. Sequence number of each segment is the number of the first byte carried in that segment. Acknowledgement number Sequence number in each direction shows the number of first byte carried by the segment. Each party also uses an acknowledgement number to confirm the bytes it has received. However, the acknowledgement number defines the number of the next byte that the party expects to receive. Acknowledgement number is cumulative, which means that the receiver takes the number of the last byte it has received, safe and sound, adds 1 to it, and announces this sum as the acknowledgement number.

19 TCP Segment Format Header Length
Number of 4-byte words in TCP header; 20 to 60 bytes Reserved: for future use Control: Used for flow control, connection establishment and termination, mode of data transfer. Window size: Size of window in bytes Checksum: Same as UDP Urgent pointer: Active only if urgent flag is set. The number is added to the sequence number to obtain the number of the last urgent byte in the data section of the segment. Options: up to 40 bytes

20 Figure Control field

21 Table 23.3 Description of flags in the control field

22 Connection Establishment: 3-Way Handshaking
TCP establishes a virtual path between the source and destination. All the segments belonging to a message are then sent over this virtual path. Connection establishment Transmits data in full-duplex mode Three-way handshake SYN: Destination port number is a well-known port number. Initialization sequence number (ISN) is used by client. SYN + ACK: Acknowledge the first segment. ACK = Seq + 1 because there is no user data in first segment. Server must also define the client window size ACK: Client acknowledges the previous seq from server. Here also, ACK = seq + 1. Data can be sent in this third packet.

23 Figure 23.18 Connection establishment using three-way handshaking

24 A SYN segment cannot carry data, but it consumes one sequence number.
A SYN + ACK segment cannot carry data, but does consume one sequence number. An ACK segment, if carrying no data, consumes no sequence number.

25 Figure Data transfer

26 Figure 23.20 Connection termination using three-way handshaking

27 The FIN segment consumes one sequence number if it does not carry data.
The FIN + ACK segment consumes one sequence number if it does not carry data.

28 Figure Half-close

29 Figure Sliding window

30 to control the flow of data so that the destination does not become
A sliding window is used to make transmission more efficient as well as to control the flow of data so that the destination does not become overwhelmed with data. TCP sliding windows are byte-oriented.

31 Example 23.4 What is the value of the receiver window (rwnd) for host A if the receiver, host B, has a buffer size of 5000 bytes and 1000 bytes of received and unprocessed data? Solution The value of rwnd = 5000 − 1000 = Host B can receive only 4000 bytes of data before overflowing its buffer. Host B advertises this value in its next segment to A.

32 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.

33 Example 23.6 Figure shows an unrealistic example of a sliding window. The sender has sent bytes up to 202. We assume that cwnd is 20 (in reality this value is thousands of bytes). The receiver has sent an acknowledgment number of 200 with an rwnd of 9 bytes (in reality this value is thousands of 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.

34 Figure Example 23.6

35 Some points about TCP sliding windows:
❏ The size of the window is the lesser of rwnd and cwnd. ❏ The source does not have to send a full window’s worth of data. ❏ The window can be opened or closed by the receiver, but should not be shrunk. ❏ The destination can send an acknowledgment at any time as long as it does not result in a shrinking window. ❏ The receiver can temporarily shut down the window; the sender, however, can always send a segment of 1 byte after the window is shut down.

36 ACK segments do not consume sequence numbers and are not acknowledged.

37 In modern implementations, a retransmission occurs if the retransmission timer expires or three duplicate ACK segments have arrived.

38 No retransmission timer is set for an ACK segment.

39 Data may arrive out of order and be temporarily stored by the receiving TCP,
but TCP guarantees that no out-of-order segment is delivered to the process.

40 Figure 23.24 Normal operation

41 Figure Lost segment

42 The receiver TCP delivers only ordered data to the process.

43 Figure 23.26 Fast retransmission

44 Figure 13.1 IEEE standard for LANs

45 The end Important to do at home : - read chapter 23 of the textbook


Download ppt "Process-to-Process Delivery, TCP and UDP protocols"

Similar presentations


Ads by Google