Vous êtes sur la page 1sur 12

CS65-Computer Networks Dept.

of EEE

Duties…
• The transport layer is responsible for process-
process-to
to--process
delivery—
delivery —the delivery of a packet, part of a message, from
one process to another.

TRANSPORT LAYER

Example 1 Example 2

port addresses

network addresses

physical address

3 4

S.Muralidharan 1
CS65-Computer Networks Dept. of EEE

Transport Layer Protocols


• Transport Layer has two protocols
1. TCP (Transmission Control Protocol) is a connection-oriented
protocol.
2. UDP (User Datagram Protocol) is connectionless (UDP) protocol

5 6

Service Access Point Service Access Point …contd

• Data link layer protocol need to know which two computers N Layer
peer-to-peer protocol
within a network are communicating. Service N layer N layer
user entity entity
• Network level protocol need to know which two computers
Protocol Data Unit
within an internet are communicating.
• Transport level protocol need to know which upper layer N PDU N Layer PDU N PDU
SAP
protocols are communicating through Service Access
Points(SAP).
Service N-1 layer N-1 layer
provider entity entity
Service Data Unit

N-1 Header N SDU

N-1 Layer PDU Encapsulation

7 8

S.Muralidharan 2
CS65-Computer Networks Dept. of EEE

Service Access Point …contd Service Access Point …contd

• To implement process-to-process communication, client- • Client and server will interact to using special packet to
server paradigm is easier. know the port address, they want to communicate. But
• Both client and server process have the same name. requires more overhead.
– For eg. To get the day and time from remote machine, we need a
Daytime client process running on the local host and a Daytime
• To avoid this, internet uses universal port numbers for
server process running on a remote machine. servers called “well-known port numbers”.
• Like MAC address at Data link layer, IP address at Network • Every client process knows the well-known port number of
layer , Transport layer uses Port number to identify a corresponding server process.
process.
• In the internet model, port numbers are 16-bit integers
between 0 & 65,535.
• The client program defines a port number chosen randomly
by the transport layer protocol running on it. This is called Shortlived/Brief well-known
“Ephemeral Port Number” port number port number

9 10

Port Number IP addressing Vs Port addressing


• Internet Assigned Number Authority (IANA) has divided
ports into three ranges : Well known, Registered and Dynamic. •IP defines the host to be
selected among the different
hosts in the world.
•Port number defines one of
the processes on this
– Well-known : Ranges between 0 and 1023; assigned and controlled
by IANA particular host.
– Registered : Ranges between 1024 and 49151; not assigned and
controlled by IANA but can be registered with IANA to prevent
duplication.
– Dynamic : Ranges between 49152 and 65635; neither controlled nor
registered; can be used by any process. These are aphemeral ports.

11 12

S.Muralidharan 3
CS65-Computer Networks Dept. of EEE

Socket Address Multiplexing & Demultiplexing


• This is the combination of IP address and port number • Transport entity perform multiplexing function with respect to
the network services that it uses.

13 14

Multiplexing & Demultiplexing ….Contd Connectionless & Connection Oriented


• Upward multiplexing – single transport layer share multiple • Connectionless service :
higher layer – Packets are sent from one party to another with no need for
• Downward multiplexing – single transport layer share connection establishment and connection release.
multiple lower layer – Packets are not numbered , they may be delayed or lost or arrive
out of sequence.
– There is no acknowledgement
• Connection oriented service :
– Connection is established before transferring data and at the end
connection is released.

15 16

S.Muralidharan 4
CS65-Computer Networks Dept. of EEE

Reliable and Unreliable Reliable and Unreliable …contd

• Transport layer service can be reliable or unreliable. If the • ISO has defined three types of network services :
higher layer (application layer) needs reliability, we use a – Type A : network connections with acceptable residual error rate
reliable transport layer by employing flow and error control. and acceptable rate of signaled failures. (Reliable)
• Error is defined as a lost or duplicated network protocol data – Type B : network connections with acceptable residual error rate
unit. but unacceptable rate of signaled failure. (Unreliable)
• If the error is caught and corrected by the network service in – Type C : network connections with residual error rate not
a fashion that is transparent to the transport entity, no acceptable to the transport service user. (Unreliable)
damage is done.
• If the network service detects an error, cannot recover, and
signals the transport entities, this is known as a signaled
failure.
• Those which are not corrected and for which the transport
entity is not notified is called residual error.

17 18

Position of UDP, TCP, and SCTP in TCP/IP suite Transmission Control Protocol (TCP)
• User Datagram Protocol (UDP) is connectionless and unreliable ; • TCP is a connection-
connection-oriented protocol
Transmission Control Protocol (TCP) and Stream Control Transmission
Protocol (SCTP) are connection oriented and reliable. • It creates a virtual connection between two TCPs to send
data. In addition, TCP uses flow and error control
mechanisms at the transport level.
• Services provided by TCP are
– Process-to-process communication
– Stream Delivery service
– Sending and receiving buffer
– Segments
– Full duplex communication
– Connection oriented service
– Reliable service

19 20

S.Muralidharan 5
CS65-Computer Networks Dept. of EEE

Well-known ports used by TCP Stream Delivery


• TCP allows the sending process to deliver data as a stream
of bytes and allows 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.

21 22

Sending & Receiving Buffers TCP Segments


• Since the sending and receiving process may not be • Though Transport layer handle in the form of streams of
working at the same speed, a circular array of 1-byte length data, the service provider for Transport layer, ie. Network
is used as buffer by both the stations. layer (IP), handles the data in the form of packets.
• Hence TCP groups a number of bytes together into a packet
called “Segment” and adds a header to it.
• These segments are encapsulated by IP datagram and
transmitted.
• Segments need not be of same size.

23 24

S.Muralidharan 6
CS65-Computer Networks Dept. of EEE

Others services….
• TCP offers Full Duplex Communication
• TCP offers Connection oriented service
• TCP offers Reliable service

25 26

Numbering System Example


• Numbering is used for flow & error control Imagine a TCP connection is transferring a file of 6000 bytes.
• Byte Number : The first byte is numbered 10010.
– TCP numbers all the data bytes that are transmitted in a connection, What are the sequence numbers for each segment if data are sent in five
– When TCP receives bytes of data from a process, it stores them in the segments with the first four segments carrying 1000 bytes and the last segment
sending buffer and numbers them. carrying 2000 bytes?
– The numbering scheme start with a random number between 0 and 232 – 1.
• Sequence Number : The following shows the sequence number for each segment:
– After numbering each bytes of data, TCP assigns a sequence number to
each segment that is being sent. Segment 1 ==> sequence number: 10010 (range: 10,010 to 11,009)
– The sequence number for each segment is the number of the first byte Segment 2 ==> sequence number: 11010 (range: 11,010 to 12,009)
carried in that segment.
Segment 3 ==> sequence number: 12010 (range: 12,010 to 13,009)
• Acknowledgement Number : Segment 4 ==> sequence number: 13010 (range: 13,010 to 14,009)
– It defines the number of next byte that the receiving end expects. Segment 5 ==> sequence number: 14010 (range: 14,010 to 16,009)
– Acknowledgement is cumulative.

27 28

S.Muralidharan 7
CS65-Computer Networks Dept. of EEE

TCP Segment Format


• TCP Segment consists of a 20-byte(without options) to 60-
bytes(with options) header followed by data. • Source Port and Destination Port — Identifies points at which
upper-layer source and destination processes receive TCP services.

• Sequence Number — Usually specifies the number assigned to


the first byte of data in the current message. In the connection-
establishment phase, this field also can be used to identify an initial
sequence number to be used in an upcoming transmission.

• Acknowledgment Number — Contains the sequence number of


the next byte of data the sender of the packet expects to receive.

• HLEN — Header Length - Indicates the number of 32-bit words in


the TCP header and thereby it indicate where the data field begins.

• Reserved — Remains reserved for future use.

29 30

• Flags (6 bits)
• Window — Specifies the size of the sender’s receive window (that is,
the buffer space available for incoming data).

• Checksum — used to indicate whether the segment was damaged in


transit.

• Urgent Pointer — Points to the first urgent data byte in the packet.

• Options — Specifies various TCP options [Max. segment size,


window scale – upto 214 (i.e., 65,536 x 214 = 107,37,25,440 bytes) &
Time stamp option]

• Data — Contains upper-layer information.

31 32

S.Muralidharan 8
CS65-Computer Networks Dept. of EEE

TCP Header Overload Connection establishment using three-way handshaking

• Connection establishment
– By “Three way handshake”
– Between pairs of ports
– One port can connect to multiple destinations
– Server program informs its TCP that it is ready to accept any
connection. This is called “Passive open”. But a server cannot initiate
any connection.
– A client program issues a request for an “active open”
– Malicious attacker may send a large number of SYN segments to the
server, pretending that each of them is coming from a different client
by faking the source. Without knowing this server may started
allocating its resources, which sometimes lead to server crash. This
attack is called “SYN flooding attack” and to manage this situation
server may restrict the number of connections or avoid requests from
unwanted sources.

33 34

Connection establishment using three-way handshaking Data Transfer


A SYN segment • Data transfer
cannot carry data,
but it consumes one – Logical stream of octets
sequence number – Octets numbered modulo 232
– Flow control by credit allocation of number of octets
A SYN+ACK
– Data buffered at transmitter and receiver
segment cannot – To overcome buffering and requiring immediate attention, data is
carry data, but does transferred with PSH flag set.
consume one
sequence number – To draw the immediate attention by the receiving TCP, URG flag is
used.
An ACK segment, if
carrying no data,
consumes no
sequence number.

35 36

S.Muralidharan 9
CS65-Computer Networks Dept. of EEE

Data transfer Connection termination using three-way handshaking

• Connection termination
– Graceful close
– TCP users issues CLOSE primitive
– Transport entity sets FIN flag on last segment sent
– Abrupt termination by ABORT primitive
• Entity abandons all attempts to send or receive data
• RST segment transmitted

37 38

Connection termination using three-way handshaking Half-close

FIN segment
consumes one
sequence number
if it does not carry
data

The FIN+ACK
segment
consumes one
sequence
number if it
does not carry
data

39 40

S.Muralidharan 10
CS65-Computer Networks Dept. of EEE

TCP – a state transition diagram Flow control


input/output

• The amount of data a source can send before receiving


an ACK from the destination
• Whether to send 1 byte of data and wait for ACK or send
all the bytes and wait for the ACK for the complete
message?
• TCP gives a solution in between
– Sliding window protocol
• byte oriented

Already dealt along with Unit I

Client
Server

41 42

USER DATAGRAM PROTOCOL(UDP) UDP Header


• It is the simplest form of transport protocol.
• The datagram packet of this protocol has the following
fields
• Source port address :Address of the application program that has
created the message.
• Destination port address : Address of the application program
that will receive the message
• Total length : The total length field defines the total length of the
user datagram in bytes
• Check sum : The checksum is a 16-bit field used in error
detection
• Data

43 44

S.Muralidharan 11
CS65-Computer Networks Dept. of EEE

Why is there a UDP? • TCP (Transmission Control Protocol)


• no connection establishment (which can add delay) – delivery is guaranteed (registered letter)
• simple: no connection state at sender, receiver – both endpoints are connected
• small segment header • UDP (User Datagram Protocol)
• no congestion control: UDP can blast away as fast as desired – delivery is not guaranteed (postcard)
• Provides only the basic functions needed for end-to-end – both endpoints are not connected
delivery of a transmission
• Doesn't provide any sequencing or reordering functions
• Cannot specify the damaged packet when reporting error. It
simply discovers the error.
• Doesn't contain any ID or sequencing number for particular
data segment.

45 46

TCP is a connection-oriented protocol; a connection can be made from client to


server, and from then on any data can be sent along that connection.
• Reliable - TCP manages message acknowledgment, retransmission and timeout. Many attempts to
reliably deliver the message are made. If it gets lost along the way, the server will re-request the lost
part. In TCP, there's either no missing data, or, in case of multiple timeouts, the connection is dropped.
• Ordered - if two messages are sent along a connection, one after the other, the first message will reach
the receiving application first. When data packets arrive in the wrong order, the TCP layer holds the
later data until the earlier data can be rearranged and delivered to the application.
• Heavyweight - TCP requires three packets just to set up a socket, before any actual data can be sent.
It handles connections, reliability and congestion control. It is a large transport protocol designed on top
of IP.
• Streaming - Data is read as a "stream," with nothing distinguishing where one packet ends and another
begins. Packets may be split or merged into bigger or smaller data streams arbitrarily.
UDP is a simpler message-based connectionless protocol. With UDP messages
(packets) cross the network in independent units.
• Unreliable - When a message is sent, it can't be known if it will reach its destination; it could get lost
along the way. There's no concept of acknowledgment, retransmission and timeout.
• Not ordered - If two messages are sent to the same recipient, the order in which they arrive cannot be
predicted.
• Lightweight - There is no ordering of messages, no tracking connections, etc. This means it's a lot
quicker. It's a small transport layer designed on top of IP.
• Datagrams - Packets are sent individually and are guaranteed to be whole if they arrive. Packets have
definite bounds and no split or merge into data streams may exist

47

S.Muralidharan 12

Vous aimerez peut-être aussi