Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 K. Salah Module 6.0: Transport Layer Protocols UDP & TCP Chapter 23 & 24.

Similar presentations


Presentation on theme: "1 K. Salah Module 6.0: Transport Layer Protocols UDP & TCP Chapter 23 & 24."— Presentation transcript:

1 1 K. Salah Module 6.0: Transport Layer Protocols UDP & TCP Chapter 23 & 24

2 2 K. Salah

3 3 Port Numbers TCP connection: is identified by a pair of two endpoints {tcp,client IP address, 64,295}  {tcp,server IP address, 23} {tcp,client IP address, 64,295} is called a TCP socket.

4 4 K. Salah Web Ports Two clients, using the same destination port number (80) to communicate with the same Web server application. What kind of server is this?

5 5 K. Salah Multiplexing and Demultiplexing Multiplexing –At the sender site, there may be several processes that need to send packets. However, there is only one transport-layer protocol [UDP or TCP]. –Protocol accepts messages from different process, differentiated by their assigned port number. After adding the header, the transport layer passes the packet to network layer. Demultiplexing –At receiver site, the transport layer receives datagrams from network layer. –After error checking and dropping of the header, the transport layer delivers each message to the appropriate process based on the port number.

6 6 K. Salah Port Ranges Port numbers are divided into three ranges: –Well-known ports: 0 to 1023. –Registered ports: Ports ranging from 1024 to 49151 are not assigned or controlled by IANA. They can only be registered with IANA to prevent duplication. –Dynamic ports: Ports ranging from 49152 to 65535 are neither controlled nor registered. They can be used by any process. These are the ephemeral ports.

7 7 K. Salah Well-known ports used by UDP PortProtocolDescription 7EchoEchoes a received datagram back to the sender 9DiscardDiscards any datagram that is received 11UsersActive users 13DaytimeReturns the date and the time 17QuoteReturns a quote of the day 19ChargenReturns a string of characters 53NameserverDomain Name Service 67BootpsServer port to download bootstrap information 68BootpcClient port to download bootstrap information 69TFTPTrivial File Transfer Protocol 111RPCRemote Procedure Call 123NTPNetwork Time Protocol 161SNMPSimple Network Management Protocol 162SNMPSimple Network Management Protocol (trap)

8 8 K. Salah PortProtocolDescription 7 EchoEchoes a received datagram back to the sender 9DiscardDiscards any datagram that is received 11UsersActive users 13DaytimeReturns the date and the time 17QuoteReturns a quote of the day 19ChargenReturns a string of characters 20FTP, DataFile Transfer Protocol (data connection) 21FTP, ControlFile Transfer Protocol (control connection) 23TELNETTerminal Network 25SMTPSimple Mail Transfer Protocol 53DNSDomain Name Server 67BOOTPBootstrap Protocol 79Finger 80HTTPHypertext Transfer Protocol 111RPCRemote Procedure Call Well-known ports used by TCP

9 9 K. Salah Error control If data link layer is reliable and has flow and error control, do we need this at the transport layer ? –Reliability at the data link layer is between two nodes –We need reliability between two ends. –Because the network layer in the Internet is unreliable (best-effort delivery), we need to implement reliability at the transport layer. –To understand that error control at the data link layer does not guarantee error control at the transport layer.

10 10 K. Salah IP IP is unreliable IP is connectionless So is UDP? So why need UDP?

11 11 K. Salah UDP UDP is a connectionless, unreliable transport protocol. It does not add anything to the services of IP except for providing process-to-process communication instead of host-to-host communication. It performs very limited error checking. –UDP is a 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.

12 12 K. Salah 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)  is 1’s complement of the 1’s complement sum of all the 16-bit words in the packet ( headers + data).  Its optional to do checksum. If not done, put the entries as all 0s.

13 13 K. Salah –A process that requires simple request-response communication with little concern for flow and error control. –It is not usually used for a process that needs to send bulk data, such as FTP –A process with internal flow and error control mechanisms. For Trivial File Transport Protocol (TFTP) includes flow and error control. It can easily use UDP. –A suitable transport protocol for multicasting. Multicasting capabilities are embedded in the UDP software but not in TCP software –UDP is used for some route updating protocols such as Routing Information Protocol (RIP) –UDP is used in conjunction with the Real-Time Transport Protocol (RTP) to provide a transport-layer mechanism for real-time data. Applications

14 14 K. Salah Transmission Control Protocol (TCP) Reliable protocol Stream connection-oriented and reliable transport protocol. Adds connection-oriented and reliability features to the services of IP 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.

15 15 K. Salah TCP Segment Hello dear friend. I am sending a letter … Hello dear friend. I am sending a letter.............. Hello dear friend. I am sending a letter … Buffer Segment 1 Segment 2

16 16 K. Salah TCP Segments Segments are not necessarily the same size. There are two buffers, the sending buffer and the receiving buffer, for each direction. TCP is full-duplex

17 17 K. Salah Numbering Bytes 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 2 32 – 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.

18 18 K. Salah Example Imagine a TCP connection is transferring a file of 6000 bytes. The first byte is numbered 10010. What are the sequence numbers for each segment if data are sent in five segments with the first four segments carrying 1000 bytes and the last segment carrying 2000 bytes? Solution The following shows the sequence number for each segment: Segment 1 ==> sequence number: 10,010 (range: 10,010 to 11,009) Segment 2 ==> sequence number: 11,010 (range: 11,010 to 12,009) Segment 3 ==> sequence number: 12,010 (range: 12,010 to 13,009) Segment 4 ==> sequence number: 13,010 (range: 13,010 to 14,009) Segment 5 ==> sequence number: 14,010 (range: 14,010 to 16,009)

19 19 K. Salah TCP Header

20 20 K. Salah Header Fields Sequence number, Acknowledgement number, and Window size are used for implementing sliding window flow and error control. Checksum is 1’s complement of the 1’s complement sum of all the 16-bit words in the TCP packet (TCP pseudoheader + TCP header + data segment). TCP psuedoheader is locally computed at source and destination. At destination, it is computed by IP layer. HLEN or Offset is the size of TCP header measured in 32-bit multiples. Urgent pointer specifies a position within the data stream (sequence number + 1). Example is hitting ESC key to abort a hung-up telnet session. Options and Padding. This is only 32-bit field. A common option is the MSS (Maximum Segment Size) that restricts the size of TCP segment and is negotiated at the start of TCP connection. Usually MSS = (MTU – fixed TCP&IP headers) to avoid further fragmentation. Padding is filling with zeros to allow 32-bit boundary.

21 21 K. Salah TCP Pseudoheader To double check that TCP segment got received by correct destination. Data may get delivered to wrong IP address. Violation of layering boundaries. Used also for UDP

22 22 K. Salah Control Field URG data contained is urgent is should be processed by receiver ASAP. Used to send out of band signals to receiver by jumping the sender and receiver queues. ACK indicates the Acknowledgment number is valid. PSH sends whatever accumulated data to server applications ASAP. Situations include: one query, end of message, in interactive processes when hitting, in FTP when sending last segment of a file. RST tells the receiver to release connection and its resources. This happens under abnormal conditions, e.g., the sender is having errors/timeouts/disconnect communicating with receiver. SYN indicates opening a connection. FIN indicates closing a connection


Download ppt "1 K. Salah Module 6.0: Transport Layer Protocols UDP & TCP Chapter 23 & 24."

Similar presentations


Ads by Google