Transport Control Protocol (TCP) & Applications
Download
Report
Transcript Transport Control Protocol (TCP) & Applications
G64INC
Introduction to Network Communications
Ho Sooi Hock
Transport and Application
Layers
IP Service Paradigm
• Connectionless
– no connection setup
– per packet (datagram) routing decision
• Unreliable
– possibility of error, loss, and out of order arrival at
the receiver
• Application programmers typically require
reliability (although not always)
Reliable Communication
• The Transmission Control Protocol (TCP) establishes a
reliable end-to-end communication service on top of
Internet Protocol (IP)
• TCP has no knowledge of the underlying internet
infrastructure
• It provides various mechanisms to overcome limitations
of IP
Data Delivery Types
Seven Major Features of TCP
1.
2.
3.
4.
5.
6.
7.
Connection oriented
Point to point
Complete reliability – delivered as sent
Full duplex communication
Stream interface
Reliable connection setup
Graceful connection shutdown
Packet Loss
• Sender sets a timer
• Receiver sends an
acknowledgement of
successful receipt
• Timeout results in
retransmission
• Receiver to watch out for
duplicates due to
network delay
• Limit number of attempts
before giving up
Adaptive Retransmission
• Sensible timer values vary greatly on an
internet (network load)
• TCP monitors the delay on a connection and
adapts the timer
– notes time taken to receive acknowledgements
– computes weighted average and variance over many
transmissions and uses these to set the timer
Two Different Timeouts
Out of Order &
Duplicate Transmissions
• TCP views data as an unstructured but ordered
stream of bytes => assembled into segments
• Sequence number for a segment is the byte-stream
number of the segment’s first data byte
• The receiver notes the number of the last segment
that arrived in sequence and stores additional out of
order segments
• Out of order segments are reassembled into the
correct sequence before delivering to the application
• Sequence numbers also allow duplicates to be
detected and discarded
Avoiding Replay Caused by Delay
• A wondering segment might turn up in a later
session (e.g., if it was queued in a switch for a
long time)
• May be confused with a segment from the
later session that uses the same sequence
number
• Solution is to include a unique session
identifier in the segment
Three Way Handshake
• Uses special Synchronisation (SYN) and Finish (FIN) control
messages to open and close connections
• Each end of the new connection randomly generates a 32 bit
connection identifier
Three Way Handshake
• Asymmetric connection release
– abrupt and may result in loss of data
• Three way handshake
– graceful disconnection
Data Overrun
• Data overrun occurs when the sender sends
faster than the receiver can receiver
• Simple solution is to acknowledge each packet
before sending the next (“stop and go”)
• However, this can be wasteful of bandwidth
– capacity = 2 Mbps, packet size = 1000 octets, delay =
50 ms
– sender has to wait 100 ms before sending next packet
– data rate is 1000 octets every 100 ms = 80000 bps =
4% of available capacity
Flow Control
• TCP uses a window mechanism
• Each end of the connection allocates a buffer
and notifies the other end of its size
• Receiver sends available window size in each
acknowledgement (window advertisement)
• Receiver sends window advertisement when the
application consumes some data
• Zero window advertisement tells the sender to
stop transmitting until further notice
Network Congestion
• Congestion arises due to too much traffic and/or
bottlenecks in the network
• Limited storage in switches means that packets
get dropped
• Detecting congestion
– switches can inform senders (network assisted)
– packet loss can be used as a measure of congestion
(end to end)
Dealing with Congestion
• Congestion Control
– solution is rate control
• TCP monitors network health through
segment transmission, i.e. ACK or timeout
– first lost segment, TCP backs right off and sends
just one segment
– if this is not lost, doubles data size and sends two
segments
– continues exponential growth until half
receiver’s window size is reached then slows
rate of increase
TCP Segment Format
• TCP messages are called segments
Identifying a Particular Service
• Transport protocols assign a unique identifier to
each service
– server process registers its ID with protocol software
when it starts up
– client specifies the desired ID when it makes a
connection
• TCP uses protocol port numbers
– well known and ephemeral
IP Addresses and Port Numbers
Client/Server Paradigm
• A widely used form of communication
• A server provides, while a client requests for a
specific service
• Server application waits passively for contact from
clients
• Client application actively initiates contact with the
server
• Information can flow in both directions
• Typical situations is many clients interacting with
each server
Concurrency and Servers
• Concurrent server offers support of multiple clients at the same time
• Uses multiple threads of control
• Core part of server accepts new requests and dynamically creates new
server processes as separate service threads to handle them
• Each thread deals with its client’s requests
• N concurrent clients => N + 1 threads
• TCP uses one well-known port and many ephemeral ports
Complex Client/Server Interactions
• A server for one service can itself become a client
of another server
• Watch out for circular dependencies, e.g. a file
server uses a time server to obtain the current time
whenever a file is accessed/modified; and the time
server also keeps records of each request and store
the records in the file server.
Layered Application Architecture
• Presentation layer
– Concerned with presenting the results of a computation
to system users and with collecting user inputs
• Application processing layer (Business Logic)
– Concerned with providing application specific
functionality e.g., in a banking system, banking functions
such as open account, close account, etc.
• Data management layer
– Concerned with managing the system databases
Thin and Fat Clients (2-Tier)
• Thin-client model
– In a thin-client model, all of the application processing
and data management is carried out on the server. The
client is simply responsible for running the presentation
software.
• Fat-client model
– In this model, the server is only responsible for data
management. The software on the client implements the
application logic and the interactions with the system
user.
Thin Client Model
• Used when legacy systems are migrated to client
server architectures
– The legacy system acts as a server in its own right with a
graphical interface implemented on a client
• A major disadvantage is that it places a heavy
processing load on both the server and the network
Fat Client Model
• More processing is delegated to the client as the
application processing is locally executed
• Most suitable for new C/S systems where the
capabilities of the client system are known in
advance
• More complex than a thin client model especially
for management. New versions of the application
have to be installed on all clients
Three-tier Architectures
• In a three-tier architecture, each of the application
architecture layers may execute on a separate
processor
• Allows for better performance than a thin-client
approach and is simpler to manage than a fat-client
approach
• A more scalable architecture - as demands increase,
extra servers can be added
DNS: Domain Name System
Domain Name System specifies the name syntax and the rules
for delegation authority over names. It provides:
• hierarchical domain based naming scheme
• distributed database implemented in a hierarchy of many
name servers
primarily for mapping host names to IP addresses
• the Internet is divided into several hundred top level domains
(TLDs)
– each domain covers many hosts
– each domain is partitioned into sub-domains, which are further
partitioned and so on which are independently managed
The DNS Name Space
Administration: Domain Allocation
• Naming follows organisational boundaries, not physical
networks
– departments sharing the same LAN can have distinct domains
– hosts in departments split over several buildings can have the
same domain
• Each domain controls how it allocates its sub-domains,
without external permission
• To create a new domain, permission is required of the
domain in which it will be included
• Top level domains (TLDs) are administered by registries,
e.g. InterNIC for .com, .org, .net, .edu
Name Servers
Part of the DNS name space showing the division into zones.
A zone is a fully connected subset of the domain name space administered as a single
unit. It must have at least two name servers. Name servers must identify all subzone name servers
Root zone information is cached by most/all name servers
DNS Name Servers
• No server has all name-to-IP address
mappings
• Name server types
Local name servers:
– each ISP, company has local (default)
name server
– host DNS query first goes to local
name server
Authoritative name server:
– for a host: stores that host’s IP address,
name
– can perform name/address translation
for that host’s name
Root name servers:
‒
‒
contacted by local name server
that can not resolve name
it then
contacts authoritative name
server if name mapping not
known
gets mapping
returns mapping to local
name server
Root Name Servers
•
•
Contacted by local name server that can not resolve name
Root name server:
– contacts authoritative name server if name mapping not known
– gets mapping
– returns mapping to local name server
a NSI Herndon, VA
c PSInet Herndon, VA
d U Maryland College Park, MD
g DISA Vienna, VA
h ARL Aberdeen, MD
j NSI (TBD) Herndon, VA
k RIPE London
i NORDUnet Stockholm
m WIDE Tokyo
e NASA Mt View, CA
f Internet Software C. Palo Alto, CA
b USC-ISI Marina del Rey, CA
l ICANN Marina del Rey, CA
13 root name servers
worldwide
DNS Records
DNS: distributed db storing resource records (RR)
RR format: (name, ttl, type, value)
• Type=A
– name is hostname
– value is IP address
• Type=NS
– name is domain (e.g. foo.com)
– value is IP address of authoritative
name server for this domain
• Type=CNAME
– name is alias name for some
“canonical” (the real) name
www.ibm.com is really
servereast.backup2.ibm.com
– value is canonical name
• Type=MX
– value is name of mailserver
associated with name
DNS: Name Queries
root name server
Recursive Query:
iterated query
2
• puts burden of name
resolution on contacted
name server
recursive query
3
4
7
Iterated Query:
• contacted server replies
with name of server to
contact
local name server
dns.eurecom.fr
1
8
requesting host
intermediate name server
dns.umass.edu
5
6
authoritative name server
dns.cs.umass.edu
surf.eurecom.fr
gaia.cs.umass.edu
Response Caching
• Once (any) name server learns mapping, it caches
mapping
– gives a “non-authoritative” reply to query
– cache entries timeout (disappear) after some time
• Needed for scalability, e.g. avoid accessing remote
name servers for every similar query
Acknowledgements
Most lecture slides used in this presentation
are adopted from the same module taught in
Nottingham, UK Campus, with addition of
diagrams from the reference texts by
Douglas E. Comer, Forouzan, Tanenbaum
and Kurose & Ross