Date post: | 14-Apr-2018 |
Category: |
Documents |
Upload: | aarti-khare |
View: | 215 times |
Download: | 0 times |
of 17
7/27/2019 37 Networking Sol
1/17
Transport Layer: UDP, TCP
7/27/2019 37 Networking Sol
2/17
Internet Transport ProtocolsTCP
Connection-oriented
setup required between client
and server
Reliable transport
Flow control
Wont overwhelm receiver
Congestion control Wont overwhelm network
Does not provide
Timing and throughputguarantees, security
UDP
Unreliable data transfer
Does not provide Connection setup, reliability, flow
control, congestion control,timing and throughputguarantee, or security
Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
7/27/2019 37 Networking Sol
3/17
UDP Services
Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
User Datagram Protocol Service
OSI Transport Layer
Provides a thin layer over IP
16-bit port space (distinct from TCPports) allows multiple recipients on a
single host
7/27/2019 37 Networking Sol
4/17
UDP Services
Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
Unit of Transfer
Datagram (variable length packet)
Packet boundaries are preserved
when receiving data (a readoperation yields packet payload as itwas originally sent.
Unreliable
No guaranteed delivery
Drops packets silently Unordered
No guarantee of maintained order ofdelivery
Unlimited Transmission
No flow control
Postal Mail
Unreliable
Not necessarily in-order
Letters sentindependently
Must address each reply
7/27/2019 37 Networking Sol
5/17
UDP Packet structure
Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
Quiz: by locking at UDP packet structure, can youguess what services are provided by UDP?
bits 0-15 16-310
32
64
Source port Destination port
Length Checksum
Data
7/27/2019 37 Networking Sol
6/17
UDP Packet structure
Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
UDP provides
application multiplexing (via port numbers)
integrity verification (via checksum) of the header and payload
packets are sent individually and error checked only if they arrive
if any kind of transmission reliability is needed, it must beimplemented at application level
bits 0-15 16-310
32
64
Source port Destination port
Length Checksum
Data
7/27/2019 37 Networking Sol
7/17
When should I use UDP?
Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
Why should I use UDP? After all, TCP is a betteralgorithm!
7/27/2019 37 Networking Sol
8/17
When should I use UDP?
Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
Why should I use UDP? After all, TCP is a betteralgorithm!
Reliability of TCP comes with some costs TCP needs 3 packets to set up a connection
UDP header has 8 bytes instead of 20 (like TCP header)
UDP is a better choice for interactive (soft real-time) voice
and video traffic (like Skype). During real-time streaming, it is better to occasionally lose
few packets (slight QoS degradation) rather thanintroducing large delays if lost packets are retransmitted.
7/27/2019 37 Networking Sol
9/17
TCP Connections Transmission Control Protocol (TCP) Service
TCP is a protocol running on OSI Transport Layer
Service Model
Byte stream (interpreted by application); packetboundaries cannot be distinguished by application
16-bit port space allows multiple connections on a singlehost
Connection-oriented
Set up connection before communicating
Tear down connection when doneCopyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
7/27/2019 37 Networking Sol
10/17
TCP Service
Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
Reliable Data Transfer
Guaranteed delivery
Exactly once
Sequenced Data Transfer In-order delivery
Regulated Data Flow
Monitors network and adjusts transmissionappropriately
Data Transmission
Full-Duplex byte stream
7/27/2019 37 Networking Sol
11/17
TCP Connection Establishment
Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
3-Way Handshake
Sequence Numbers
J,K Message Types
Synchronize (SYN)
Acknowledge (ACK)
Passive Open
Server listens for connectionfrom client
Active Open
Client initiates connection toserver
Client Server
Time flows down
listen
Passive open
Active open
7/27/2019 37 Networking Sol
12/17
TCP Connection Termination
Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
Either client or server caninitiate connection teardown (4-way handshake)
Message Types
Finished (FIN)
Acknowledge (ACK)
3-way handshake is alsopossible. The sequence is FIN J,ACK J+1 & FIN K (as singlepacket), ACK K+1
Client Server
Time flows down
Active close
Passive close
7/27/2019 37 Networking Sol
13/17
TCP Reliable transmission TCP uses a sequence number to identify each byte of data.
When establishing a connection, the 3-way handshake allows remotehosts to exchange and ACKan initial sequence number (ISN).
Exploiting sequence numbers, data can be reconstructed in order,regardless of fragmentation, lack of ordering, or packet loss
Sequence number is incremented for each payload byte that is sent.
Receiver uses cumulative acknowledgment
For example, if host A sends 10 bytes with sequence numbers 100 to 109,then the receiver transmits ACK 110 since next expected byte should havesequence number 110
Copyright : Nahrstedt, Angrave, Abdelzaher, Kravets, Gupta, Caccamo
7/27/2019 37 Networking Sol
14/17
TCP Segment Format
IP header TCP header TCP data
Sequence number (32 bits)
DATA
20 bytes 20 bytes
0 15 16 31
Source Port Number Destination Port Number
Acknowledgement number (32 bits)
window sizeheaderlength
0 Flags
Options (if any)
TCP checksum urgent pointer
20bytes
TCP segments have a 20 byte header with >= 0 bytes of data.
Copyright Jorg Liebeherr 98, Modified with permission, Abdelzaher
7/27/2019 37 Networking Sol
15/17
TCP header fields
TCP
IP
Applications
23 10480Ports:
TCP
IP
Applications
7 1680 Ports:
Port number A port number identifies the endpoint of a connection A pair identifies one endpoint of a
connection Two pairs and identify a TCP connection
Copyright Jorg Liebeherr 98, Modified with permission, Abdelzaher
7/27/2019 37 Networking Sol
16/17
TCP header fields Sequence Number (SeqNo):
Sequence number is 32 bits long.
Each sequence number identifies a byte in thebyte stream
Initial Sequence Number (ISN) of a connection is
set during connection establishment
Copyright Jorg Liebeherr 98, Modified with permission, Abdelzaher
7/27/2019 37 Networking Sol
17/17
TCP header fieldsAcknowledgement Number (AckNo):
Acknowledgements are piggybacked
A host uses the AckNo field to sendacknowledgements. (If AckNo has a valid value,then the ACK flag is set)
The AckNo contains the next SeqNo that a host
(receiver) expects to receiveExample: The acknowledgement for a segmentwith sequence numbers 0-1500 is AckNo=1501
C i ht J Li b h 98 M difi d ith i i Abd l h