Professional Documents
Culture Documents
L12CN :Process-to-Process Delivery, UDP, TCP, and SCTP.
L12CN :Process-to-Process Delivery, UDP, TCP, and SCTP.
The transport layer is responsible for process-toprocess-toprocess deliverythe delivery of a packet, part of a delivery message, from one process to another. Two processes g ,f p another. p communicate in a client/server relationship, as we will see later. later. Topics discussed in this section:
Client/Server Paradigm g Multiplexing and Demultiplexing Connectionless Versus Connection-Oriented Service Reliable Versus Unreliable Three Protocols
23.2
23.1
Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
provide logical communication between app processes running on different hosts transport protocols run in end systems send side: breaks app messages into segments, passes to network layer rcv side: reassembles segments into messages, passes to app layer more than one transport protocol available to apps Internet: TCP and UDP
Household analogy:
processes = kid kids app messages = letters in envelopes hosts = houses transport protocol = Ann and Bill network-layer protocol = postal service
application transport network data link physical network data link physical
Note
network data link physical network data link physical network data link physical network data link physical
23.6
16 bits
23.7
23.8
23.9
23.10
23.11
23.12
Multiplexing/demultiplexing p g/ p g
Demultiplexing at rcv host: Multiplexing at send host: gathering data from multiple sockets, enveloping data with header (later used for demultiplexing)
P1 P1
P2
host receives IP datagrams each datagram has source IP address, destination IP address each datagram carries 1 transport-layer segment each segment has source, destination port number host uses IP addresses & port numbers to direct segment to appropriate socket
host 1
host 2
host 3
23.15
23.16
[RFC 768]
no frills, bare bones Internet transport protocol best effort service, UDP segments may be: l lost t delivered out of order to app
connectionless:
no handshaking between UDP sender, receiver each UDP segment handled independently of others
no connection establishment (which can add delay) simple: no connection state at sender, receiver small segment header no congestion control: UDP can blast away as fast as desired
UDP: more
UDP checksum
Goal: detect errors (e.g., flipped bits) in transmitted segment 32 bits source port # length dest port # checksum
often used for streaming multimedia apps loss tolerant Length, in bytes of UDP rate sensitive
Sender:
Receiver:
treat segment contents as sequence of 16-bit integers checksum: addition (1s (1 s complement sum) of segment contents sender puts checksum value into UDP checksum field
compute checksum of received segment check if computed checksum equals checksum field value: NO - error detected YES - no error detected detected.
Note
When adding numbers, a carryout from the g , y most significant bit needs to be added to the result
1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
23.22
Note
23.25
23.26
A process that requires simple request-response request response communication with little concern for flow and error control FTP A process with internal flow and error control mechanisms TFTF Multicasting Management processes SNMP Some rout updating protocols - RIP
23.30
23.31
2323-3 TCP
TCP is a connection-oriented protocol; it creates a connectionp protocol; virtual connection between two TCPs to send data. In data. addition, TCP uses flow and error control mechanisms at the transport level. level. Topics discussed in this section:
TCP Services TCP Features Segment A TCP Connection Flow Control Error Control
23.32
TCP: Overview
2581
point-to-point:
steam:
no message boundaries
bi-directional data flow in same connection MSS: maximum segment size handshaking (exchange of (e hange control msgs) inits sender, receiver state before data exchange sender will not overwhelm receiver
pp pipelined:
connection-oriented:
flow controlled:
socket door
socket door d
source port #
dest port #
checksum
23.35
23.36
23.37
TCP provides: p
The two TCPs establish a connection between them Data are exchanged in both directions The connection is terminated
23.38
23.39
Example 23.3
The file is 5000 bytes, the first byte is numbered 10,001 each segment caries 1000 byte Note
The b t Th bytes of data being transferred in fd t b i t f di each connection are numbered by TCP. S Sequence number b Acknowledgment number The Th numbering starts with a randomly b i t t ith d l generated number.
23.40
23.41
too short: premature timeout unnecessary retransmissions too long: slow reaction to segment loss
SampleRTT: measured time from segment transmission until ACK receipt ignore retransmissions SampleRTT will vary, want estimated RTT smoother average several recent l t measurements, not just current SampleRTT
Note Note
The value in the sequence number field q of a segment defines the y number of the first data byte contained in that segment.
The value of the acknowledgment field g in a segment defines the number of the next byte a party p expects to receive. The acknowledgment number is cumulative.
23.44
23.45
23.46
23.47
Figure 23.18 Connection establishment using three-way handshaking Table 23.3 Description of flags in the control field
23.48
23.49
Note
Note
A SYN segment cannot carry d t b t it t t data, but consumes one sequence number.
A SYN + ACK segment cannot t t carry data, but does consume one sequence number. b
23.50
23.51
Note
An A ACK segment, if carrying no d t t i data, consumes no sequence number. Simultaneous open SYN fl di attack flooding tt k
23.52
23.53
Note
The Th FIN segment consumes one t sequence number if it does not carry data. t d t
23.54
23.55
Note
The Th FIN + ACK segment consumes t one sequence number if it does not carry data. d t d t
23.56
23.57
Note
A sliding window is used to make transmission more efficient as well as t i i ffi i t ll to control the flow of data so that the destination does not become overwhelmed with data. TCP sliding windows are byte oriented byte-oriented.
23.58
23.59
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 S l ti The 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.
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, f f , which is 3000 bytes.
23.60
23.61
Example 23.6
Figure 23.23 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 b t B t 200 t 202 i i f d d d bytes. Bytes to are sent, but not acknowledged. Bytes 203 to 208 can be sent without worrying about acknowledgment. Bytes 209 and above cannot be sent.
23.62
23.63
Note
ACK segments d not consume t do t sequence numbers and are not acknowledged. k l d d
Note
Note
In I modern implementations, a d i l t ti retransmission occurs if the retransmission timer expires or three t i i ti i th duplicate ACK segments have arrived.
23.66
23.67
Retransmission after RTO Retransmission after three duplicate g ACK segments. Data may arrive out of order and be y temporarily stored by the receiving TCP, g but TCP guarantees that no out-of-order segment is delivered to the process.
23.68
23.69
Note
23.70
23.71
2323-4 SCTP
Stream Control Transmission Protocol (SCTP) is a new reliable, message-oriented transport layer messageprotocol. protocol. SCTP, however, is mostly designed for Internet applications that h I t t li ti th t have recently b tl been introduced. introduced. These new applications need a more sophisticated service than TCP can provide. provide. Topics discussed in this section:
SCTP Services and F t S i d Features Packet Format An SCTP Association Flow Control and Error Control
23.72
23.73
Note
SCTP is a message-oriented, reliable i i t d li bl protocol that combines the best features of UDP and TCP f d TCP.
23.74
23.75
Note
23.76
23.77
Note
23.78
23.79
Note
SCTP provides Full-duplex id F ll d l communication C Connection-oriented service ti i t d i Reliable service I SCTP, a data chunk is numbered In SCTP d t h k i b d using a TSN.
23.80 23.81
Note
Note
To di ti T distinguish between different data i hb t diff td t chunks belonging to the same stream, SCTP uses SSNs. SSN
23.82
23.83
Note
In SCTP I SCTP, control information and data t li f ti dd t information are carried in separate chunks. h k
23.84
23.85
Note
Data chunks are identified by three y items: TSN, SI, and SSN. y g TSN is a cumulative number identifying the association; SI defines the stream; SSN defines the chunk in a stream.
23.86
23.87
Note
In SCTP I SCTP, acknowledgment numbers are k l d t b used to acknowledge only data chunks; control chunks are acknowledged by t l h k k l d db other control chunks if necessary.
23.88
23.89
Note
23.90
23.91
Note
23.92
23.93
Note
No th N other chunk is allowed in a packet h k i ll di k t carrying an INIT or INIT ACK chunk. A COOKIE ECHO or a COOKIE ACK chunk can carry data chunks.
23.94
23.95
Note
In SCTP I SCTP, only DATA chunks l h k consume TSNs; DATA chunks are th only chunks h k the l h k that are acknowledged.
23.96
23.97
Note
The k Th acknowledgment i SCTP d fi l d t in defines the cumulative TSN, the TSN of the last data h k d t chunk received in order. i di d
23.98
23.99
23.100
23.101
23.102
23.103
23.104