TCP: Software for Reliable Communication

Download Report

Transcript TCP: Software for Reliable Communication

TCP: Software for Reliable
Communication
Internet: a Collection of
Disparate Networks

Different goals:


Speed, cost, distance;
Different standards for:






Spring 2002
Expected carrier;
Coding bits;
Detecting and recovering from errors;
Protocols for transmitting messages: bus, token
ring,…
Packets sizes, and encoding for the start/end of
packets,…
Types of computer addresses
Computer Networks Applications
Solution: Routers
Router
High speed
connection
Router
Router
Routers: computers design to interconnect different networks
Spring 2002
Computer Networks Applications
Solution: Internet Protocol (IP)





Divide a message in small blocks, called
packets;
IP protocol for transmitting packets;
IP hides the details of physical networks;
Every computer connected to the Internet
must run IP software
IP specifies:



Spring 2002
Packet format;
How routers should forward packets
Define address format
Computer Networks Applications
IP can be overrun

Consider the following scenario:




Spring 2002
Computers X and Y send simultaneously
messages to a computer Z across the same
network, d;
Both X and Y send 5000 packets/s
Network d may transmit 5000 packets/s;
There is an excess of 5000 packets each
second which are discarded.
Computer Networks Applications
IP can be overrun (cont.)
X

Y
Z
TCP (Transmission Control Protocol) designed
to handle this problem.
Spring 2002
Computer Networks Applications
TCP




Checks for lost datagrams;
Routers may fail TCP chooses new paths;
Because datagrams may travel different
paths, they can arrive at the destination in a
different order  TCP assembles them in the
correct order
Network failure may result in multiple copies
of the same datagram TCP checks for
duplicate datagrams, and accepts only the
first copy
Spring 2002
Computer Networks Applications
TCP- a connection oriented
protocol



IP: a connectionless protocol, i.e. there is no
connection between sender and destination;
In order to achieve its goals TCP establishes a
connection between two computers;
A data transmission proceeds much like a
telephone call:




Spring 2002
The sender program contact the destination
The destination accepts the incoming call;
The sender and destination may exchange arbitrary amounts of
data;
Any of the party may terminate the communication
Computer Networks Applications
Recovering lost datagrams


Problem: datagrams may be lost by a router
far away from the sender or the destination;
Solution:



Spring 2002
TCP includes a unique ID in each datagram;
Whenever data arrives at the destination, it sends
an acknowledgment (ack) back to the source,
containing the ID of the datagram;
If an ack is not received in a certain time the
sender retransmits the message.
Computer Networks Applications
Example of retransmission

Spring 2002
Computer Networks Applications
Retransmission is adaptive

Different values for waiting times:



Short, if source and destination are “close”
to each other;
Longer, if they are far apart.
Adjusted if delays occur

Spring 2002
TCP measures the delay in sending a
message and adjusts the timer
Computer Networks Applications
Retransmission examples

Spring 2002
Computer Networks Applications
Detecting duplicate datagram



The receiver maintains a table with all
datagrams received so far;
When the destination, receives a
datagram, checks the ID of incoming
with the IDs of the datagrams received
so far;
If it is a duplicate, the datagram is
discarded.
Spring 2002
Computer Networks Applications
TCP and IP work together



IP specifies how a packet should be
transmitted from the sender to the
destination;
TCP specifies ways for making packet
transmission reliable;
TCP/IP often used and sold as a single
software packet.
Spring 2002
Computer Networks Applications
Designing Protocols

Two possible solutions:

A single, giant protocol that specifies all
details;


Divide the problem into subpieces, and
design a special protocol for each piece;



Spring 2002
Cons: difficult to design, and to update
Each piece is called a layer;
The result: a suite of protocols;
Requires that different parts share information.
Computer Networks Applications
TCP/IP---a layered protocol




Has seven layers;
Lowest layer refers
to hardware;
Top layers refer to
the software;
The level of
abstraction
increases bottom to
top.
Spring 2002
Computer Networks Applications
TCP/IP layers:

Layer 1 (Physical layer):


Corresponds to network hardware;
defines the carrier, the way to encode bits,
etc..
Example of a carrier
Spring 2002
Computer Networks Applications
TCP/IP layers (cont.)


the carrier is reduced to 2/3 full strength to encode a 1 bit, and
1/3 strength to encode a 0 bit;
Two successive pulses needed to encode one bit; an unchanged
pulse separates two bits.
Digital signal
The resulting
wave encoding
The signal above.
Spring 2002
Computer Networks Applications
TCP/IP layers (cont.)

Layer 2: data link


Specifies how to organize data into
packets, and how to transmit packets over
a network
For ex:
maximum packet size,
 format packet header,
 checksum computation
are defined at this layer.

Spring 2002
Computer Networks Applications
TCP/IP layers (cont.)

Layer 3: Network

Specifies how addresses are formed


How packets are forwarded:


Ex: IP addresses
Ex: store and forward technique
Layer 4: Transport


Spring 2002
Handles details of reliable transfer;
EX: format of acks, retransmission times, rules for
changing it
Computer Networks Applications
TCP/IP layers (cont.)

Layer5: Session



Specifies how to establish a communication with a
remote system; ex: telnet
Authentication details; ex: passwords
Layer 6: Presentation



Spring 2002
Specifies how to represent data;
Different computers use different internal
representation (Ex: ASCII, EBDIC) for integers and
characters;
How to translate from one representation to
another
Computer Networks Applications
TCP/IP layers (cont.)

Layer 7: Application



Spring 2002
Specifies how one particular application
uses a network;
Ex: FTP
Specifies request format (how to name a
file) and how the application on another
machine responds.
Computer Networks Applications
How layered software works




Each layer solves one part of the problem;
To do so, each layer on the sending computer adds
information to the outgoing data;
The same layer in the receiving computer uses the
additional information to process data;
Ex: checksums in data layer;
Spring 2002
Computer Networks Applications
How layered software works
(cont.)

Layering Principle:
Layer N software on the
destination computer, must
receive the exact message sent
by layer N software on the
sending computer.


Ex: if one layer adds a header,
the corresponding layer has to
remove it.
If one layer encrypts data, the
receiving computer layer has to
decrypt it.
Spring 2002
Computer Networks Applications
Why layering?

Each layer can be:



Designed,
Implemented
Tested
independently of other layers.
creating and evolving protocols, much
easier task.
Spring 2002
Computer Networks Applications