Professional Documents
Culture Documents
Prepared by: KL First Prepared on: 9-09-07 Last Modified on: Quality checked by: xxx Process process delivery UDP and TCP Technology Copyright 2007 Asia to Pacific Institute of Information
Slide 1
Slide 2
Learning Outcomes
At the end of this session you should be able to: Understand rationale for the existence of the transport layer the need for process-to-process delivery.
Slide 3
Retransmission timer
Round-trip time (RTT) Segment Sender window
Sequence number
Server Silly windows syndrome
Slide 4
Transmission Control Protocol (TCP) User datagram User Datagram Protocol (UDP) Well-known port numbers
TCP timer
Three-way handshake Time-waited timer
Slide 5
Slide 6
Transport Layer
The transport layer is the core of the Internet model. It is the fourth layer in the model. This layer receives services from the network layer and provides services to the application layer. Function of transport layer (Duties)
Packetizing
Connection control
Addressing Providing reliability
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 7
Slide 8
Packetizing
The transport layer creates packets out of the message received from the application layer. Packetizing divides a long message into smaller ones and encapsulated into the data field of the transport-layer packet and headers are added.
Slide 9
Connection control
There are two categories: Connection-oriented Delivery
Create virtual connection between sender and receiver The packets are numbered consecutively and communication can take place in both directions.
Connectionless Delivery
Treats each packet independently without connection between them.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 10
Addressing
The packet carrying the request must specify to which server program the request must be delivered.
The request packet must also specify the client program that sent the packet.
Slide 11
Providing reliability
A transport layer can provide reliability for the application program that uses its service.
Flow Control
Performed end to end
Error Control
The entire message arrives at the receiving transport layer without error (damage, loss, or duplication). Error correction is usually achieved through retrasmission.
Slide 12
Process-to-Process Delivery
Node-to-node delivery is responsible for delivery of frames between two neighboring nodes over link.
Slide 13
Slide 14
Slide 15
Process-to-Process Delivery
1. 2. 3. 4. 5. Client-Server Paradigm Addressing Multiplexing and Demultiplexing Connectionless/Connection-Oriented Reliable/Unreliable
Slide 16
Client-server Paradigm
A process on the local host, called a client, needs services from a process usually on the remote host, called a server. Operating system today support both multiuser and multiprogramming environments. A remote computer can run several server programs at the same time, just as local computers can run one or more client programs at the same time.
Local host Local process Remote host Remote process
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 17
Addressing
A transport-layer address, called a port number, to choose among multiple processes running on the destination host.
The destination port number is needed for delivery; the source port number is needed for the reply. Ephemeral port number are 16-bit integers between 0 and 65,535.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 18
Port numbers
Slide 19
Addressing
The Internet has decided to use universal port numbers for servers; these are called wellknown port numbers. The IP addresses and port numbers play different roles in selecting the final destination of data.
The destination IP address defines the host among the different hosts in the world. After the host been selected, the port number defines one of the processes on this particular host.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 20
Slide 21
Slide 22
IANA ranges
Slide 23
Socket address
Slide 24
Demultiplexing: At the receiver site, the transport layer delivers each message to the appropriate process based on the port number.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 25
Slide 26
Connectionless vs Connection-Oriented
A transport-layer protocol can either be connectionless or connection-oriented. Connectionless Service The packets are sent from one party to another with no need for connection establishment or connection release.
The packets are not numbered; they may be delayed, or arrive out of sequence.
There is no acknowledgment either. Example UDP.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 27
Connection Establishment
This connection establishment implies four steps. However, since steps 2 and 3 can occur at the same time, they can be combined into one step.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 28
Connection establishment
Slide 29
Connection Termination
Connection in one direction is terminated, the other party can continue sending data in the other direction. Therefore, four actions needed to close the connections in both directions:
1. Host A sends a packet announcing its wish for connection termination. 2. Host B sends a segment acknowledging (confirming) the request of A. After this, the connection is closed in one direction, but not in the other. Host B can continue sending data to A. 3. When host B has finished sending its own data, it sends a segment to indicate that it wants to close the connection.
The four-step connection termination cannot be reduced to three steps because the two parties may not wish to terminate at the same time. In other words, connection termination is asymmetric.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 30
Connection termination
Slide 31
Reliable vs Unreliable
The transport-layer service can be reliable or unreliable. If the application-layer program needs reliability, we use a reliable transport-layer protocol by implementing flow and error control at the transport layer. This mean a slower and more complex service. UDP is connectionless and unreliable TCP is connection-oriented and reliable. These two can respond to the demands of the application-layer programs.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 32
Error control
Slide 33
Slide 34
Note:
UDP is a connectionless, unreliable protocol that has no flow and error control. It uses port numbers to multiplex data from the application layer.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 35
Protocol Echo Discard Users Daytime Quote Chargen Nameserver Bootps Bootpc TFTP RPC NTP SNMP SNMP
Description Echoes a received datagram back to the sender Discards any datagram that is received Active users Returns the date and the time Returns a quote of the day Returns a string of characters Domain Name Service Server port to download bootstrap information Client port to download bootstrap information Trivial File Transfer Protocol Remote Procedure Call Network Time Protocol Simple Network Management Protocol Simple Network Management Protocol (trap)
Process to process delivery UDP and TCP
Slide 36
Slide 37
Slide 38
Note: The calculation of checksum and its inclusion in the user datagram are optional.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 39
Application of UDP
UDP is suitable for 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 FTP. Internal flow and error control mechanisms. Multicasting capabilities are embedded in the UDP software but not in the 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.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 40
Note:
UDP is a convenient transport-layer protocol for applications that provide flow and error control. It is also used by multimedia applications.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 41
Slide 42
Port Numbers
Like UDP, TCP uses port numbers as tranportlayer addresses. If an application can use both UDP and TCP, the same port number is assigned to this application.
Slide 43
11
13 17 19 20 21 23 25 53
Users
Daytime Quote Chargen FTP, Data FTP, Control TELNET SMTP DNS
Active users
Returns the date and the time Returns a quote of the day Returns a string of characters File Transfer Protocol (data connection) File Transfer Protocol (control connection) Terminal Network Simple Mail Transfer Protocol Domain Name Server
67
79 80 111
BOOTP
Finger HTTP RPC
Bootstrap Protocol
Finger Hypertext Transfer Protocol
Process to process delivery UDP and TCP
Slide 44
Stream delivery
TCP, is steam-oriented protocol. In UDP, a process (an application program) sends a chunk of bytes to UDP for delivery. UDP adds its own header to this 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, on the other hand, allows the sending process to deliver data as a stream of bytes and the 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.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 45
Stream delivery
Slide 46
There are two buffers, the sending buffer and the receiving buffer, for each direction.
One way to implement a buffer is to use a circular array of 1-byte locations.
Slide 47
At the sending site, the buffer has three types of locations. The white section contains empty locations that can be filled by the sending process. The blue area hold bytes that have been sent but not yet acknowledged. The bytes in blue locations area acknowledged, the location is recycled and available for use by the sending process. After both processes have no data left to send and the buffers are empty, the two TCPs destroy their buffers.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 48
TCP segments
TCP groups a number of bytes together into a packet called a segment. TCP adds a header to each segment and delivers the segment to the IP layer for transmission. The segments are encapsulated in an IP datagram and transmitted.
The segments are not necessarily the same size. In reality segments carry hundreds, if not thousands, of bytes.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 49
TCP segments
There is no field for a segment number value. Instead, there are two field called the sequence number and the acknowledgment number. These two fields refer to the byte number, not the segment number.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 50
Byte Numbers
TCP numbers all data bytes that are transmitted in a connection. Numbering is independent in each direction.
When TCP receives bytes of data from the process and stores them in the sending buffer, it numbers them. The numbering does not necessary start from 0; it starts with a randomly generated number between 0 and 232 1.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 51
Note: The bytes of data being transferred in each connection are numbered by TCP. The numbering starts with a randomly generated number.
Slide 52
Example 1
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 Segment 1 ==> Segment 2 ==> Segment 3 ==> Segment 4 ==> Segment 5 ==>
System Programming and Computer Control
the sequence number for each segment: sequence number: 10,010 (range: 10,010 sequence number: 11,010 (range: 11,010 sequence number: 12,010 (range: 12,010 sequence number: 13,010 (range: 13,010 sequence number: 14,010 (range: 14,010
Process to process delivery UDP and TCP
Slide 53
Note:
The value of the sequence number field in a segment defines the number of the first data byte contained in that segment.
Slide 54
Note:
The value of the acknowledgment field in a segment defines the number of the next byte a party expects to receive. The acknowledgment number is cumulative.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 55
Slide 56
Slide 57
Header
Source port address: This is a 16-bit field that defines the port number of the application program in the host that is sending the segment. Destination port address: receiving the segment. Sequence number: defines the number assigned to the first byte of data contained in this segment (range 232). To ensure connectivity, each byte to be transmitted is numbered. The sequence number tells the destination which bytes in this sequence comprises the first byte in the segment.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 58
Header
Acknowledgment number: This 32-bit field defines the byte number that the sender of the segment is expecting to receive from the other party. If the byte numbered x has been successful received, x+1 is the acknowledgment number. Header length: This 4-bit field indicates the number of 4-byte words in the TCP header. The length of the header can be between 20 and 60 bytes. Therefore, the value of this field can be between 5 (5x4 = 20) and 15 (15x4 =60). Reserved: This field defines 6 different control bits or flags which can be set at a time. These bits enable flow control, connection establishment and termination, and the mode of data transfer in TCP.
Slide 59
Control field
Slide 60
Flag
URG ACK PSH RST SYN FIN
Description
The value of the urgent pointer field is valid. The value of the acknowledgment field is valid. Push the data. The connection must be reset. Synchronize sequence numbers during connection. Terminate the connection.
Slide 61
Slide 62
Slide 63
The application has requested the closing of the connection. The other side has accepted the closing of the connection. Waiting for retransmitted segments to die. The server is waiting for the application to close.
Process to process delivery UDP and TCP
Slide 64
Slide 65
Note: 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. TCPs sliding windows are byte-oriented.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 66
Sender buffer
Slide 67
Receiver window
Slide 68
Slide 69
Slide 70
Slide 71
Slide 72
Note: In TCP, the sender window size is totally controlled by the receiver window value (the number of empty locations in the receiver buffer). However, the actual window size can be smaller if there is congestion in the network.
System Programming and Computer Control Process to process delivery UDP and TCP
Slide 73
Slide 74
Lost segment
Slide 75
Lost acknowledgment
Slide 76
TCP timers
Slide 77