TCP Protocol xxOK
TCP Protocol xxOK
CS641
Computer Networking
OSI v TCP/IP
•Figure: illustrates the
layers of the TCP/IP
and OSI architectures,
showing roughly the
correspondence in
functionality between
them
2
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
1
2/14/2023
OSI Layers
3
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
Transport Protocols
• In protocol architecture, transport protocol sits above a
network or internet-work layer, which provides network-
related services, and just below application and other
upper-layer protocols
• Transport protocol provides services to transport
service (TS) users, such as FTP, SMTP, TELNET
• The local transport entity communicates with some
remote transport entity, using the services of some lower
layer, e.g. IP protocol
• The general service provided by a transport protocol is
end-to-end transport of data in a way that shields the TS
user from the details of the underlying comm. systems
4
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
2
2/14/2023
5
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
6
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
3
2/14/2023
Reliable Sequencing
Network Service
• Assume arbitrary length message (be accepted by
network service)
• Assume virtually 100% reliable delivery by network
service : Examples
—e.g. reliable packet switched network using X.25
—e.g. frame relay using LAPF control protocol
—e.g. IEEE 802.3 using connection-oriented LLC service
• Transport service is end-to-end protocol between
two systems on same network (rather than across
Internet)
7
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
8
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
4
2/14/2023
Addressing (1)
• Transport protocol must be able to derive listed info
from TS user address
• Target user needs to be specified by:
—User identification
• Usually host, port
– Called a socket in TCP
• Port represents a particular transport service (TS) user at specified
host
—Transport entity identification
• Generally only one transport entity per host
• If more than one, then usually one of each type (the address should
include a designation of transport entity protocol)
– Specify transport protocol (TCP, UDP)
9
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
Addressing (2)
• Transport protocol must be able to derive listed info
from TS user address
• Target user needs to be specified by:
—Host address
• An attached network device
• In an Internet, a global Internet address
• Because routing is not transport layer concern, it simply passes Host
portion of address down to network service.
• Port is included in transport header, (to be used at destination by
destination transport protocol entity)
—Network number
10
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
5
2/14/2023
Finding Addresses
• Four methods
1. Know address ahead of time
• e.g. collection of network device stats
2. Well known addresses: some commonly used services are assigned
“well-known- addresses” e.g., FTP (20), SMTP (25), HTTP (80)
3. Name server: TS user requests service by some global name. the
request is sent to the name server, which does a directory look and
returns address. --- then proceeds with connection, --- useful for
commonly used applications that change location from time to time,
e.g, data entry process may be moved from host to host in LAN to
balance load
4. Sending process request to well-known address: user at
that address is privileged system process that will spawn
(generate) the new process and returns an address. e.g.,
programmer developed private application (simulation program)
that will execute on remote server, but be invoked from local
workstation. A request can be issued to remote job-
management process that spawns the simulation program
11
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
Multiplexing
• Multiple users employ same transport protocol
• Users identified by port number or service access
point (SAP)
• May also multiplex with respect to network services
used
—e.g. multiplexing a single virtual X.25 circuit to a number of
transport service user
• X.25 charges per virtual circuit connection time
12
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
6
2/14/2023
Flow Control
• Flow control is complex mechanism at the transport
layer, because:
—Longer transmission delay between transport entities
compared with actual transmission time
Delay in communication of flow control info
—Variable transmission delay (transport layer operates over
network or Internet)
Difficult to use timeouts for lost data retransmission
• Flow may be controlled because:
—The receiving user can not keep up with the flow of data
—The receiving transport entity can not keep up with the flow
of segments
• Results in buffer filling up , need to prevent overflow
13
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
14
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
7
2/14/2023
15
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
8
2/14/2023
Credit Scheme (2 ):
Use of Header Fields
• When transport entity sends a segment, it includes
seq number of first octet in the segment data field
• (refer to windows mechanism terminology)
• ACK includes AN=i, W=j
• All octets through SN=i-1 acknowledged
—Next expected octet is i
• Permission is granted to send additional window of
W=j octets of data
—i.e. octets through i+j-1
17
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
18
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
9
2/14/2023
Credit Scheme (3 ):
Figure Explanation
• Figure Explanation
• Show data flow in one direction only
• Assume:200 octets of data are sent in each segment
• Initially, through connection establishment process, sending &
receiving sequence no.s are synchronized and A is granted
initial credit allocation of 1400 octets, beginning with octet no.
1001
• After sending 600 octets in 3 segments, A has shrunk its
window size to 800 octets (no.s 1601-2400)
• After B receives 3 segments (600octets out of its original 1400
octets =credit, 800 outstanding)
19
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
Credit Scheme (4 ):
Figure Explanation
• Suppose, at this point, B is capable of absorbing 1000 octets of
incoming data on this connection. Accordingly, B acknowledges
receipt of all octets through 1600 and issues a credit of 1000
octets. This means A can send octets 1601-2600 (5 segments)
• However, by the time that B’s message has arrived at A, A has
already sent 2 segments, containing octets 1601-2000
(permissible under initial allocation). Thus, A’s remaining credit
upon receipt of B’s credit allocation is only 600 octets (3
segments).
• As the exchange proceeds, A advances the trailing edge of its
window each time that it transmits and advances the leading
edge only when it is granted credit
20
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
10
2/14/2023
Credit Scheme (5 ):
Figure Explanation
• Both sides take both views because data may be exchanged in
both directions
• Receiver is not required to acknowledge incoming segments
immediately, but may wait and issue cumulative
acknowledgement for no. of segments
• Receiver needs to adopt some policy concerning the amount of
data it permits the sender to transmit: conservative approach is
to only allow new segments up to the limit of available buffer
space
• Conservative flow control scheme may limit throughput of the
transport connection in long-delay situations. Receiver could
potentially increase throughput by optimistically granting credit
for space it does not have
21
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
22
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
11
2/14/2023
23
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
Establishment and
Termination
• Even reliable network service needs connection
establishment and termination procedures
• connection establishment services 3 main
purposes:
1. Allow each end to now the other exists
2. Allow exchange/negotiation of optional parameters (e.g.
Max segment size, max window size, QOS)
3. Triggers allocation of transport entity resources (e.g. Buffer
space, entry in connection table)
• connection establishment done by mutual agreement
and can be accomplished by simple set of user
commands and control segments (Fig. 6.3) 24
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
12
2/14/2023
Establishment and
Termination
—To begin TS user is in closed state (i.e. It has no transport
entity)
—TS user can signal to local TCP entity it will passively wait
for a request with passive Open command
—After passive Open command is issued. Transport entity
creates connection object of some sort (i.e., table entry)
(Listen state)
—TS user may change its mind by sending Close command
—From closed state, TS user may open connection by issuing
active Open Command, which instructs transport entity to
attempt connection establishment with designated remote
TS user, which triggers the transport entity to send SYN
segment (synchronize)
25
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
Establishment and
Termination
—This segment carried to receiving transport entity and
interpreted as request for connection to a particular
port
• If destination entity in LISTEN state for that port, then
connection established by the following actions by
receiving transport entity:
—Signal local TS user that connection is open
—Send SYN as confirmation to remote transport entity
—Put the connection object in ESTAB (establishment) state
• When responding SYN received by initiating transport entity, it
can move connection to ESTAB state, or it may closed by either
TS user Close command
26
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
13
2/14/2023
27
د/عزالدين محمد سويسي/كلية تقنية المعلومات/جامعة طرابلس /ليبيا
28
د/عزالدين محمد سويسي/كلية تقنية المعلومات/جامعة طرابلس /ليبيا
14
2/14/2023
30
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
15
2/14/2023
31
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
32
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
16
2/14/2023
Figure
shows
TCP Entity
State
Diagram
33
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
34
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
17
2/14/2023
TCP Services
• Services provided to TS user
• TCP Services are reliable end-to-end transport
of data
• Service categories
1. Multiplexing
2. Connection management
3. Data transport
4. Special capabilities
5. Error reporting
35
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
TCP Multiplexing
• Multiplexing
—TCP can simultaneously provide service to multiple processes
within host
—Process identified with port
—Socket is :IP address + port=unique
throughout the Internet
—TCP provides service by means of logical
connection between pair of sockets
—TCP can support multiple connections to the
application layer simultaneously (instance of
multiplexing)
—TCP can support multiple connections to the
same application in application layer
simultaneously (instance of multiplexing) 36
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
18
2/14/2023
Figure shows a
Multiplexing Example
37
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
19
2/14/2023
20
2/14/2023
• Error Reporting
—TCP will report service failure due to internetwork
conditions for which TCP cannot compensate
41
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
42
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
21
2/14/2023
Table
Request Primitives
6
. TCP Service
4
43
د/عزالدين محمد سويسي/كلية تقنية المعلومات/جامعة طرابلس /ليبيا
Table
Response Primitives
6
. TCP Service
5
44
د/عزالدين محمد سويسي/كلية تقنية المعلومات/جامعة طرابلس /ليبيا
22
2/14/2023
Table
6
.
6
TCP parameters
45
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
46
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
23
2/14/2023
Figure Explains
Basic TCP Operation
48
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
24
2/14/2023
49
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
TCP Header:
read details at home
50
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
25
2/14/2023
52
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
26
2/14/2023
UDP Header
27
2/14/2023
UDP Uses
• Inward data collection
—Involves periodic active or passive data sources sampling
—Such as sensors, and automatic self-test reports from
security equipment or network components
—e.g. In real-time monitoring situation, loss of an occasional
data unit wouldnot cause distress, because next report
should arrive shortly
• Outward data dissemination
—Includes broadcast messages to network users,
announcement of new node or change of address of service,
and distribution of real-time clock values
55
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
UDP Uses
• Request-Response
—Applications in which transaction service provided by
common server to no. of distributed TS users, and for which
single request-response sequence is typical
—Use of service is regulated at application level, and lower
level connections are often unnecessary and cumbersome
• Real time application
—Such as voice and telemetry, involving degree of
redundancy and/or real-time transmission requirement
—These must not have connection-oriented functions such as
retransmission
56
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
28
2/14/2023
Required Reading
• Chapter 6 ” Computer Networks with Internet
Technology” by William Stallings
• Comer, S. Internetworking with TCP/IP,
volume 1, Prentice-Hall
• All RFCs mentioned plus any others connected with
these topics
—www.rfc-editor.org
• Loads of Web sites on TCP/IP and IP version 6
57
ليبيا/جامعة طرابلس/كلية تقنية المعلومات/عزالدين محمد سويسي/د
29