TCP or UDP - Sistel IMT 2010

Download Report

Transcript TCP or UDP - Sistel IMT 2010

Modul 4
Transport Protocol TCP / UDP
Mata Kuliah
Sistem Telekomunikasi
Semester Genap 2009 - 2010
Pengenalan
• Layer Transport adalah layer end-to-end pertama dalam OSI 7
Layer Reference Model
– Hanya beroperasi di end-systems (misalnya hosts / terminals)
• Layer transport TCP adalah layer tertinggi berorientasi fungsi
komunikasi
– Layer diatasnya dianggap berorientasi “user” atau “application”
• The transport layer is typically implemented in software running in
the host operating system’s kernel (kernel adalah suatu perangkat lunak yang
menjadi bagian utama dari sebuah sistem operasi. Tugasnya melayani bermacam program
aplikasi untuk mengakses perangkat keras komputer secara aman)
– Higher layers are typically running within application
• programs i.e. they are realised as software libraries linked with them
– A running transport protocol is called a Transport Entity
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
2
CONNECTION-ORIENTED AND CONNECTIONLESS
• A transport protocol can be:
– Connection-oriented (CO) reliable
– Connectionless (CL) unreliable
•
There do not exist connection-oriented unreliable
transport protocols in a similar fashion to protocols in
lower layers
– Remember that ATM (network) and Frame Relay (data link) are
connection-oriented unreliable
•
A transport connection is an end-system notion (i.e.
state kept in the two communicating hosts), totally
unrelated to virtual circuits in the lower layers
– We may have CO transport over CL network layer
over IP
– We may also have CO transport over CO network layer
based) e.g. OSI TP over X.25
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
e.g. TCP
(i.e. VC3
TRANSPORT PROTOCOLS
•
OSI Transport Protocol (TP)
– It is used with ISO/ITU-T OSI network layer protocols e.g. X.25,
CLNP
– Tidak dibahas
•
Transmission Control Protocol (TCP)
– Used over IP (the latter goes over anything)
•
User Datagram Protocol (UDP)
– CL unreliable service over IP
•
Real-Time Protocol (RTP)
– CL unreliable service over UDP/IP for real-time traffic streams
e.g. voice, video
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
4
TRANSPORT LAYER FOR INTERNET
SNMP
Simple Network Management Protocol
NFS
Network File System
RPC
Remote Procedure Call, e.g. Sun RPC, but OMG CORBA
RPC (GIOP) uses TCP
(T)FTP
(Trivial) File Transfer Protocol
BOOTP
BOOT Protocol
DNS
Domain Name System
HTTP
HyperText Transfer Protocol
SMTP
Simple Mail Transfer Protocol
UDP
User Datagram Protocol
TCP
Transmission Control Protocol
IP
Internet Protocol
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
5
INTERNET PROTOCOL STACK AND SAPs
• TSAP: Transport Service Access Point  Port
• NSAP: Network Service Access Point  IP Address
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
6
ADDRESSING
• A host is identified through its IP address
• TCP/UDP can serve several applications within a host
through different ports
– An Internet port is equivalent to the OSI transport selector
– Since there are no explicit session and presentation layers in the
Internet protocol architecture, there exists only one type of port
i.e. transport
• An application (in fact transport) address is thus the
combination {port, IP address}
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
7
ADDRESSING
• The transport protocol (TCP or UDP) needs also to be
known as the same port number identifies different
applications over TCP and over UDP
• Port numbers below 256 are well-known ports, used
for standard services
– For example, TCP port 23 is the one in which the Telnet server listens
– The UDP port 161 is the one in which the SNMP agent (daemon)
listens
– An ever-running server is called daemon in UNIX terminology and its
program name ends typically with the letter d e.g. telnetd, snmpd, etc.
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
8
TRANSMISSION CONTROL
PROTOCOL (TCP)
PENGENALAN
• TCP provides a reliable error-free transport service over an
unreliable internetwork; TCP adapts dynamically to the properties of
the internetwork and is robust to many kinds of failures
• Data is delivered in sequence, with no losses or duplicates
• The reliable transport service provided is similar to the OSI CO
transport service, with one key difference:
– The TCP service is “stream-based” while the OSI transport service is “packetbased”
• TCP treats all user data as a byte (octet) stream; since full duplex
communication is provided, two unidirectional streams are
supported
• TCP “protocol data units” (OSI terminology) are called segments; a
segment may contain several short TCP user messages or can be
part of a larger message
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
10
PENGENALAN (Cont. )
•
•
•
•
Because of its stream nature, the sending TCP entity may store data
passed to it to transmit in a buffer and transmit it when the buffer has
“enough” data.
The same may take place in the receiving TPC entity, regarding data
delivery to the application
The user may force data to be transmitted and delivered immediately
The user may also indicate that data is urgent which means it will be
delivered outside the flow control of normal data
– This is similar to “expedited data” in the OSI transport protocol
•
When an acknowledgement is not received within a time-out period, the
segment is retransmitted – TCP deploys a sliding window ARQ protocol for
flow control with its own special characteristics
–
–
Because of its stream nature, the sequence and acknowledgment numbers refer to bytes in
the byte stream, not to segments
Window size is adaptive to congestion in the network and performs “selfpolicing” to avoid
burdening the network further and achieve fairness
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
11
TCP USER SERVICE PRIMITIVES: CONNECTION
ESTABLISHMENT
• “Full passive open” means that a remote address and possibly port from which
to expect a connection are specified
• “Active open with data” means that initial data is sent to the server in the
connection request
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
12
TCP USER SERVICE PRIMITIVES: DATA EXCHANGE
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
13
TCP USER SERVICE PRIMITIVES: CONNECTION
RELEASE
• Orderly connection release needs both ends to agree – remember that
OSI TP supports only abrupt connection release; this is of course also
supported in TCP
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
14
TCP DATA TRANSFER
• 3W data has to be delivered in 3 segments of W data. The client buffers the
first segment and delivers 2W buffered data to the application. The first ACK
reduces the window to W since there is W buffered data and the second ack
restores it. After the first ack, the server can send the third segment. This is
buffered for a while with the window reduced to W but then it is delivered to
Pebruari 2010
Sistem Telekomunikasi
the application and a second ack
is sent,
restoring the window to 2W.
Semester
Genap 2009-2010
15
TCP CONNECTION ESTABLISHMENT
If both ends try to establish a connection to each other simultaneously, only
one connection is established because of the three-way handshake
procedure required – in the OSI TP two connections are established
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
16
TCP GRACEFUL CONNECTION TERMINATION
• Here we assume that the server has still outstanding data of length
N (N<=W) to send after the client has required connection
termination; the server sends it together with its own request to
close the connection
• If the client had closed the connection unilaterally, this data would be
Pebruari 2010
Sistem Telekomunikasi
lost
Semester Genap 2009-2010
17
USER DATAGRAM PROTOCOL
UDP
USER DATAGRAM PROTOCOL
•
User Datagram Protocol (UDP) is a connectionless transport protocol
provided in the TCP/IP suite
–
•
It allows applications to send encapsulated IP datagrams withouthaving to establish a
transport connection
IP does not provide error/flow control and UDP allows upper layer
applications to exploit this property:
1. Useful for real-time multimedia streams where retransmission is meaningless and flow
control causes packet jitter
2. Its connectionless nature makes it also suitable for real-time multicast
3. Also useful for applications prepared to perform their own error control e.g. NFS/RPC, SNMP
•
•
Note that the protocol field in the IP header indicates the transport protocol
to deliver the datagram (TCP or UDP)
Many applications in a host may use UDP services; this is done through
different transport ports as explained
–
Remember that an Internet application is attached to an equivalent to the OSI TSAP, with the
address being {port, IP Address}
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
19
UDP SEGMENT HEADER
• The UPD header consists
of
– Source and Destination
port
– Length of datagram,
including 8 byte header
and body
– Checksum of the complete
datagram
• The source application
needs to know the IP
address and the port
number of the destination
to send a datagram to it
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
20
UDP FUNCTIONALITY
• UDP is the simplest possible transport protocol, being an
almost direct pass-through to IP services
• It allows many applications to use UDP/IP services
through different transport ports
• Applications are not allowed to use network services
directly since this means layering violation
– Using UDP is as close as possible to using directly IP services
i.e. best-effort datagrams are sent
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
21
REAL TIME PROTOCOL
RTP
REAL-TIME STREAMS AND TRANSPORT
RELIABILITY
•
•
Real-time traffic requires guaranteed throughput, low latency, low jitter, low
packet loss and low processing overhead both in the network routers and in
the terminals
TCP is not suitable for real-time traffic due to its error-free nature through
error and flow control
–
•
Reliability is not an issue for real-time audio/video streams
–
•
Packet re-transmission for reliability is meaningless, packets in error should be simply
dropped
Possibility of adaptive applications:
–
–
•
Introduces jitter and also increases processing overhead
An application could be made aware about error rate and about the quality of delivery to the
other end in general
It may then deal with it e.g. adaptive applications may reduce their send rate according to the
network condition
TCP adapts to network congestion but UDP does not – we sometimes refer
to TCP traffic as “network friendly” since it takes into account the state of
the network
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
23
REAL-TIME PROTOCOL
• The Real-Time Protocol (RTP) operates on top of UDP for realtime
(potentially multicast) traffic and can provide input to the application
about network performance and delivery quality
• As such, it is not strictly speaking a transport protocol. It can be
thought as as a generic application layer protocol that provides
transport facilities
– In terms of functionality though, it is certainly a transport protocol, hence its
examination here
•
RTP consists in fact of two protocols:
– The RTP Data Transfer Protocol, whose header includes among other fields a
sequence number and a (local clock) timestamp
– The RTP Control Protocol (RTCP) which provides feedback to RTP data sources
as well as to (mcast) session participants
– They both use UDP as transport, with separate ports at each sender for RTP
and RTCP
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
24
REAL-TIME PROTOCOL (cont’d)
• RTP (i.e. the Data Transfer Protocol) multiplexes various multimedia
streams to a single UDP stream e.g. a video and two audio channels
for a TV stereo broadcast
• The timestamps allow the receiver to estimate jitter but also to buffer
accordingly so that the streams are synchronised with each-other
• RTCP reports enable receivers to estimate data rates / transmission
quality and possibly adjust accordingly
• It should be stated that RTP is suited for “soft real-time”
communication, with feedback to allow adjust sources in the end
systems – IntServ and DiffServ support “hard real-time”
communication with guarantees supported by the network
Pebruari 2010
Sistem Telekomunikasi
Semester Genap 2009-2010
25
Terima Kasih