Upload
others
View
11
Download
0
Embed Size (px)
Citation preview
1
1
PART 1
Multimedia & Multimedia Networking
MSCEG442
Process-to-Process Delivery
UDP, TCP, and SCTP
2
Contents
• 1.1 PROCESS TO PROCESS DELIVERY
• 1.2 USER DATAGRAM PROTOCOL (UDP)
• 1.3 TCP
• 1.4 SCTP
2
3
1.1 PROCESS1.1 PROCESS--TOTO--PROCESS DELIVERYPROCESS DELIVERY
The transport layer is responsible for processThe transport layer is responsible for process--toto--process process
deliverydelivery——the delivery of a packet, part of a message, from the delivery of a packet, part of a message, from
one process to another. Two processes communicate in a one process to another. Two processes communicate in a
client/server relationship, as we will see later. client/server relationship, as we will see later.
Client/Server ParadigmMultiplexing and DemultiplexingConnectionless Versus Connection-Oriented ServiceReliable Versus UnreliableThree Protocols
Topics discussed in this section:Topics discussed in this section:
4
Types of data deliveries
• The transport layer is responsible for process-to-process delivery, the delivery of a packet, part of a message, from one process toanother.
• Two processes communicate in a client-server relationship.
• Figure below shows 3 types of deliveries and their domains
3
5
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.
• Both processes have the same name.
• Operating systems support both multiuser and multiprogramming environments. A remote computer can run several server programs at the same time. So for communication, the following must be defined:
— Local host
— Local process
— Remote host
— Remote process
6
Addressing
• At the data link layer, we need a MAC address to choose one node among several nodes if the connection is not point-to-point.
• A frame in the data link layer needs a destination MAC address for delivery and a source address for the next node’s reply.
• At the network layer we need an IP address to choose from one host among millions.
• At the transport layer we need 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
4
7
Port numbers
• Every client process knows the well-know port number of the corresponding server process.
• Eg. While the daytime client process can use a temporary port number 52,000 to identify itself, the daytime server must use the well-known permanent port number 13.
8
IP addresses versus port numbers
• The destination IP address defines the host.
• The port number defines one of the processes on this particular host.
5
9
IANA ranges
• The IANA (Internet Assigned Number Authority) has divided the port numbers into three ranges:
—Well-known ports: 0-1023
—Registered ports: 1024-49151
—Dynamic ports: 49152 – 65535 (temporary ports)
10
Socket address
• Process-to-process delivery needs two identifiers at each end to make a connection:
—An IP address
—The port number
• The client socket address defines the client process uniquely just as the server socket address defines the server process uniquely
• A transport-layer protocol needs a pair of socket addresses
—The client socket address
—The server socket address
The combination of an IP address and a port
number is called a socket address
6
11
Multiplexing and demultiplexing
• The addressing mechanism allows MUXing and DeMUXing by the transport layer
• At the sender site, there may be several processes that need to send packets
— However there is only one UDP or TCP protocol. This is a many-to-one relationship and requires MUXing
• At the receiver site, the relationship is one-to-many and requires DeMUXing
— The transport layer receives datagrams from the network layer. After error checking and dropping of the header, the transport layer delivers each message to the appropriate process
12
Error control
• Error control is needed at the transport layer, too, even though the data link layer is reliable and has flow and error control.
— The reason is that the data link takes care of the reliability between two nodes
— However, since the network layer (IP) is unreliable (best effort) we need to implement reliability at the transport layer.
— Flow and error control in TCP is implemented by the sliding window protocol.
7
13
UDP, TCP and SCTP in TCP/IP suite
14
Contents
• 1.1 PROCESS TO PROCESS DELIVERY
• 1.2 USER DATAGRAM PROTOCOL (UDP)
• 1.3 TCP
• 1.4 SCTP
8
15
1.2 USER DATAGRAM PROTOCOL (UDP)1.2 USER DATAGRAM PROTOCOL (UDP)
The User Datagram Protocol (UDP) is called a The User Datagram Protocol (UDP) is called a
connectionless, unreliable transport protocol. It connectionless, unreliable transport protocol. It
does not add anything to the services of IP except does not add anything to the services of IP except
to provide processto provide process--toto--process communication process communication
instead of hostinstead of host--toto--host communication. host communication.
Well-Known Ports for UDPUser DatagramChecksumUDP OperationUse of UDP
Topics discussed in this section:Topics discussed in this section:
16
Well-known ports used with UDP
9
17
In UNIX, the well-known ports are stored in a file called /etc/services. Each line in this file gives the name of the server and the well-known port number. We can use the grep utility to extract the line corresponding to the desired application.
The following shows the port for FTP. Note that FTP can use port 21 with either UDP or TCP.
Example
18
Example (continued)
SNMP uses two port numbers (161 and 162), each for a different purpose.
10
19
User datagram format
• UDP packets called user datagrams, have a fixed-size header of 8-bytes
20
UDP length
= IP length – IP header’s length
Note
11
21
UDP applications
• UDP is suitable for a process that requires simple request-response communication with little concern for flow and error control. It is not suitable for processes that send bulk data such as FTP
• UDP is suitable for a process with internal flow and error control mechanisms. Eg. TFTP can use UDP.
• UDP is suitable for multicasting
• UDP is used for some route updating protocols such as RIP.
• UDP is used in conjunction with RTP to provide a transport-layer mechanism for real-time data
• UDP is suitable for multimedia applications
22
Contents
• 1.1 PROCESS TO PROCESS DELIVERY
• 1.2 USER DATAGRAM PROTOCOL (UDP)
• 1.3 TCP
• 1.4 SCTP
12
23
1.3 TCP1.3 TCP
TCP is a connectionTCP is a connection--oriented protocol; it creates a virtual oriented protocol; it creates a virtual
connection between two connection between two TCPsTCPs to send data. In addition, to send data. In addition,
TCP uses flow and error control mechanisms at the TCP uses flow and error control mechanisms at the
transport level. transport level.
TCP ServicesTCP FeaturesSegmentA TCP ConnectionFlow ControlError Control
Topics discussed in this section:Topics discussed in this section:
24
Well-known ports used by TCP
13
25
TCP services
• The services offered by TCP to the processes at the application layer are the following:
— Stream delivery
— Sending and receiving buffers
— TCP segments
— Full-duplex
— Connection-oriented
— reliability
26
Stream delivery
• TCP is a stream-oriented protocol.
— It allows the sending process to deliver data as a stream of bytes and the receiving process to obtain data as a stream of bytes.
— It creates an environment in which the two processes seem to be connected by an imaginary “tube” that carries their data across the Internet
14
27
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 and the receiving.
— Buffers can be implemented by using a circular array of 1-byte locations as shown below
28
TCP segments
• Buffering handles the difference between the speed of the producing and the consuming processes.
• We need one more step:
— The TCP groups a number of bytes into a packet called a segment, and adds a header to it before delivering it to the IP layer.
15
29
The bytes of data being transferred in
each connection are numbered by TCP.
The numbering starts with a randomly
generated number.
Note
30
The following shows the sequence number for each segment:
Example
16
31
The value in the sequence number field
of a segment defines the
number of the first data byte
contained in that segment.
Note
32
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.
Note
17
33
TCP segment format
34
Control field
18
35
Connection
• TCP is a connection-oriented protocol
• It establishes a virtual path between the source and the destination.
— All segments belonging to a message are then sent over this virtual path
• In TCP, connection-oriented transmission requires two procedures:
— Connection establishment
— Connection termination
36
Connection establishment using three-way handshaking
• TCP transmits data in full-duplex mode
• Four steps are needed to establish the connection:
— Client SYN segment
— Server SYN segment
— Server ACK
— Client ACK
} combined into one step
1. The client sends the 1st SYN segment (source & destination address)
2. The server sends a SYN+ACK segment to acknowledge receipt of the 1st segment, to define the client window size and also to initialize the number of bytes sent from the server to the client
3. The client sends a 3rd
segment (ACK) to acknowledge receipt of the 2nd segment
19
37
A SYN + ACK segment cannot carry data, but does consume one
sequence number.
Note
An ACK segment, if carrying no data,
consumes no sequence number.
A SYN segment cannot carry data, but it consumes one sequence number.
38
Data transfer
20
39
Connection termination using three-way handshaking
• Any of the parties (client or server) can close the connection
1. The client TCP send the 1st
segment, a FIN segment
2. The server TCP sends the 2nd segment (ACK+FIN) to confirm the receipt of the FIN segment from the client and to notify that it does not have any more data to send
3. The client TCP sends the 3rd
segment, an ACK to confirm the receipt of the FIN segment from the TCP server
40
The FIN segment consumes one
sequence number if it does
not carry data.
Note
The FIN + ACK segment consumes
one sequence number if it
does not carry data.
21
41
Half-close
• Any of the parties (client or server) can close the connection
• When connection in one direction is terminated, the other party can
continue sending data in the other direction
1. The client TCP send the 1st
segment, a FIN segment
2. The server TCP sends the 2nd segment ACK to confirm the receipt of the FIN segment from the client
3. The TCP server sends a FIN segment to notify that it does not have any more data to send
4. The client TCP sends the 4th
segment, an ACK to confirm the receipt of the FIN segment from the TCP server
42
Flow control
• Flow control defines the amount of data a source can send beforereceiving an acknowledgement from the destination.
• In an extreme case, a transport-layer protocol could send 1 byte of data and wait for an ACK before sending the next byte
— This is extremely slow. If the data are travelling a long distance, the source is idle while waiting for the ACK
• At the other extreme, a transport-layer protocol can send all data it has without worrying about an ACK
— This speeds up the process but it may overwhelm the receiver. Also if some parts are lost or data are corrupted, the source will not know
until all data have been checked by the destination
• TCP has a solution that stands somewhere in between
— It defines a window that is imposed on the buffer of data delivered from the application program and is ready to be send.
— TCP sends as many data as are defined by the sliding window protocol
22
43
Sliding window
• With this method, both hosts use a window for each connection
• The window spans a portion of the buffer containing bytes that ahost can send before worrying about an ACK from the other host
• The window is called a sliding window because it can slide over the buffer as data and ACKs are sent and received
44
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.
Note
23
45
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?
Example
SolutionThe value of rwnd = 5000 − 1000 = 4000. Host B can receive only 4000 bytes of data before overflowing its buffer. Host B advertises this value in its next segment to A.
46
What is the size of the window for host A if the value of rwndis 3000 bytes and the value of cwnd is 3500 bytes?
Example
SolutionThe size of the window is the smaller of rwnd and cwnd, which is 3000 bytes.
24
47
Figure in next slide shows an unrealistic example of a sliding window. The sender has sent bytes up to 202. We assume that cwndis 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.
Example
48
Example
25
49
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 atany time as long as it does not result in a shrinkingwindow.
� The receiver can temporarily shut down thewindow; the sender, however, can always send asegment of 1 byte after the window is shut down.
Note
50
ACK segments do not consume
sequence numbers and are not
acknowledged.
Note
26
51
In modern implementations, a
retransmission occurs if the
retransmission timer expires or three
duplicate ACK segments have arrived.
Note
52
No retransmission timer is set for an
ACK segment.
Note
27
53
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.
Note
54
Normal operation
28
55
Lost segment
56
The receiver TCP delivers only ordered
data to the process.
Note
29
57
Fast retransmission
58
Contents
• 1.1 PROCESS TO PROCESS DELIVERY
• 1.2 USER DATAGRAM PROTOCOL (UDP)
• 1.3 TCP
• 1.4 SCTP
30
59
1.4 SCTP1.4 SCTP
Stream Control Transmission Protocol (SCTP) is a new Stream Control Transmission Protocol (SCTP) is a new
reliable, messagereliable, message--oriented transport layer protocol. SCTP, oriented transport layer protocol. SCTP,
however, is mostly designed for Internet applications that however, is mostly designed for Internet applications that
have recently been introduced. These new applications have recently been introduced. These new applications
need a more sophisticated service than TCP can provide. need a more sophisticated service than TCP can provide.
SCTP Services and FeaturesPacket FormatAn SCTP AssociationFlow Control and Error Control
Topics discussed in this section:Topics discussed in this section:
60
SCTP is a message-oriented, reliable
protocol that combines the best features
of UDP and TCP.
Note
31
61
Some SCTP applications
62
TCP vs SCTP
• Whereas TCP transports a byte-stream, SCTP can transport multiple message-streams.
— All bytes sent in a TCP connection must be delivered in that order, which requires that a byte transmitted first must safely arrive at the destination before a second byte can be processed even if the second byte manages to arrive first. If an arbitrarynumber of bytes are sent in one step and later some more bytes are sent, these bytes will be received in order, but the receiver can not distinguish which bytes were sent in which step.
— SCTP in contrast, conserves message boundaries by operating on whole messages instead of single bytes. That means if one message of several related bytes of information is sent in one step, exactly that message is received in one step.
32
63
Multiple-stream concept
• The term "multi-streaming" refers to the capability of SCTP to transmit several independent streams of messages in parallel.
— For example, transmitting two images in an HTTP application in parallel over the same SCTP association. You might think of multi-streaming as bundling several TCP-connections in one SCTP-association operating with messages instead of bytes.
64
An association in SCTP can involve
multiple streams.
Note
33
65
Multihoming concept
• Multihoming is a technique to increase the reliability of the Internet connection for an IP network.
• A connection to two (or more) separate ISPs is established.
• In the case where one outgoing link from the multihomednetwork fails, outgoing traffic will automatically be routed via one of the remaining links.
66
Data chunks are identified by three
items: TSN, SI, and SSN.
TSN is a cumulative number identifying
the association;
SI defines the stream;
SSN defines the chunk in a stream.
Note
34
67
SCTP association allows multiple IP
addresses for each end.
Note
In SCTP, a data chunk is numbered
68
To distinguish between different
streams, SCTP uses an SI
Note
TCP has segments; SCTP has packets.
In SCTP, a data chunk is numbered
using a TSN.
35
69
Comparison between a TCP segment and an SCTP packet
70
In SCTP, control information and data
information are carried in separate
chunks.
Note
36
71
In SCTP, acknowledgment numbers are
used to acknowledge only data chunks;
control chunks are acknowledged by
other control chunks if necessary.
Note
72
SCTP packet format
37
73
In an SCTP packet, control chunks come
before data chunks.
Note
74
General header
38
75
Chunks
76
A connection in SCTP is called an
association.
Note
39
77
In SCTP, only DATA chunks
consume TSNs;
DATA chunks are the only chunks
that are acknowledged.
Note
78
Simple data transfer
40
79
The acknowledgment in SCTP defines
the cumulative TSN, the TSN of the last
data chunk received in order.
Note
80
Summary (1/2)
• UDP and TCP are transport-layer protocols that create a process-to-process communication.
• UDP is an unreliable and connectionless protocol that requires little overhead and offers fast delivery.
• In the client-server paradigm, an application program on the local host, called the client, needs services from an application program on the remote host, called a server.
• Each application program has a unique port number that distinguishes it from other programs running at the same time on the same machine.
• The client program is assigned a random port number called the ephemeral port number.
• The server program is assigned a universal port number called a well-known port number.
• The combination of the IP address and the port number, called the socket address, uniquely defines a process and a host.
• The UDP packet is called a user datagram.
• UDP has no flow control mechanism.
41
81
Summary (1/2)
• Transmission Control Protocol (TCP) is a connection-oriented, reliable, stream transport-layer protocol in the Internet model.
• The unit of data transfer between two devices using TCP software is called a segment; it has 20 to 60 bytes of header, followed by data from the application program.
• TCP uses a sliding window mechanism for flow control.
• Error detection is handled in TCP by the checksum, acknowledgment, and time-out.
• Corrupted and lost segments are retransmitted, and duplicate segments are discarded.
• TCP uses four timers—retransmission, persistence, keep-alive, and time-waited—in its operation.
• Connection establishment requires three steps; connection termination normally requires four steps.
• TCP software is implemented as a finite state machine.
• The TCP window size is determined by the receiver.
82
References
• B.A. Forouzan, Data Communications and Networking, 4th edition, McGraw-Hill, 2007