Download Lect03

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

RS-232 wikipedia , lookup

Computer network wikipedia , lookup

RapidIO wikipedia , lookup

Lag wikipedia , lookup

AppleTalk wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Deep packet inspection wikipedia , lookup

Zero-configuration networking wikipedia , lookup

I²C wikipedia , lookup

Remote Desktop Services wikipedia , lookup

Parallel port wikipedia , lookup

IEEE 1355 wikipedia , lookup

Real-Time Messaging Protocol wikipedia , lookup

UniPro protocol stack wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Internet protocol suite wikipedia , lookup

TCP congestion control wikipedia , lookup

Transcript
Address Resolution Protocol
• Internet uses IP address to recognize a computer.
• But IP address needs to be translated to physical
address (NIC).
• ARP does this job.
• It takes IP address and gives corresponding
physical address.
TCP/IP
1
How ARP Works?
•
•
•
•
•
There are three methods
1) Table look up
2) Closed form computation
3) Message Exchange
In table look up the mapping information is stored
in a table in the computer’s memory.
• In closed form method an algorithm is used to
map IP address to a physical address.
TCP/IP: Basics
2
How ARP Works?
• In message exchange, a message is broadcast to all
the computer on the network with the IP address.
• The computer with that IP address sends its
physical address which is maintained in a cache.
• ARP is local, that is, it is done on local network.
TCP/IP: Basics
3
Transmission Control Protocol
• Transmission Control Protocol or TCP
provides:
– Reliability
•
•
•
•
Error Control
Loss Control
Sequence Control
Duplication Control
– Point to Point or Port to Port Communication
– Full duplex
– Connection Oriented
TCP/IP: Basics
4
???
• TCP uses IP for data delivery (like UDP)
• Endpoints are identified by ports (like UDP)
– Allows multiple connections on each host
– Ports may be associated with an application or a
process
• IP treats TCP messages like data and does
not interpret any contents of the TCP
message.
TCP/IP: Basics
5
???
• TCP message travels in IP datagrams.
• Internet routers only look at IP header to
forward datagrams.
• TCP at destination interprets TCP messages.
TCP/IP: Basics
6
TCP Segment Format
• Same header format used in both directions
• Segment can carry both data and
acknowledgment.
• Flag field has 6 1-bit flags. SYN = 1 means
request to establish connection. FIN = 1
means end of connection.
TCP/IP: Basics
7
Ports and Socket
• A single computer can be running several
applications (email, FTP, HTTP and others).
• TCP is application to application (port to port)
protocol, IP is computer to computer protocol.
• TCP uses port numbers to identify different
application running on a single computer.
• A port is a 16-bit number allocated to a particular
application.
TCP/IP: Basics
8
Ports and Socket
• A port identifies a single application on a
computer.
• A socket or socket address is IP address and port
number concatenated together. Example:
192.20.10.10:80
• This enables multiple application on one machine
to communicate simultaneously.
• Normally server port numbers are fixed and
known as well known ports so that client can send
a request to a known application.
TCP/IP: Basics
9
Ports and Socket
A Typical Scenario
• When a client application sends a TCP request to a
server application, it provides server application
port number.
• The TCP software on client allocates an unused
port number to that client application.
• The server receives the request and TCP software
passes it to the intended server application.
• The server replies with its own port number and
the client port number.
TCP/IP: Basics
10
Ports and Socket
A Typical Scenario
Client
Source port number = 23
Destination port number = 80
Source
Source port number = 80
Destination port number = 23
TCP/IP: Basics
11
Delivery in TCP
TCP/IP: Basics
12
Three-way Handshake
• TCP uses three-way handshake for reliable
connection establishment and termination
– Host 1 sends segment with SYN bit set and random
sequence number.
– Host 2 responds with segment with SYN bit set,
acknowledgment to Host 1 and random sequence
number.
– Host 1 responds with acknowledgment.
TCP/IP: Basics
13
Closing a Connection
TCP/IP: Basics
14
TCP Connection Types
• TCP has two types of connections:
– Non Persistent connection
– Persistent connection
• In non persistent connection TCP
connection is closed by the server once the
client request is served.
• In persistent connection the connection is
not closed and client can use it as many
time as needed.
TCP/IP: Basics
15
TCP Connection Types
• There are two types of persistent
connections.
– Without pipelining
– With pipelining
• Without pipelining the new request could be
sent to the sever only once the previous
request is served
• With pipelining several requests can be
made simeltaneously.
TCP/IP: Basics
16
Reliable Delivery
• TCP uses many techniques described earlier to
provide reliable delivery
• Recovers from
–
–
–
–
–
–
–
Lost packets
Duplicate packets
Delayed packets
Corrupted data
Transmission speed mismatches
Congestion
System reboots
TCP/IP: Basics
17
Lost Packets
• TCP uses positive acknowledgment with
retransmission to achieve reliable data delivery
• Recipient sends acknowledgment control messages
(ACK) to sender to verify successful receipt of
data
• Sender sets timer when data transmitted; if timer
expires before acknowledgment arrives, sender
retransmits (with new timer)
TCP/IP: Basics
18
Lost Packets
TCP/IP: Basics
19
TCP Segments
• Application delivers arbitrarily large chunks
of data (blocks) to TCP as a “stream”.
• TCP breaks this data into segments, each of
which fits into an IP datagram.
• Original stream is numbered by bytes.
• Segment contains sequence number of data
bytes.
TCP/IP: Basics
20
Acknowledgements
• Receiver sends segment with sequence
number of acknowledged data (not
segments).
• One ACK can acknowledge many
segments.
TCP/IP: Basics
21
Timeout
• Inappropriate timeout can cause poor
performance:
– Too long - sender waits longer than necessary before retransmitting
– Too short - sender generates unnecessary traffic
• Timeout must be different for each connection and
set dynamically
– Host on same LAN should have shorter timeout than
host 20 hops away
– Delivery time across internet may change over time;
timeout must accommodate changes
TCP/IP: Basics
22
RTOs for Different Network
Delays
TCP/IP: Basics
23
Choosing RTO
• Timeout should be based on round trip time or
delay (RTT)
• Sender estimates RTT for each active connection
by measuring the time needed to receive a
response. Updated dynamically.
• Sender picks retransmission timeout (RTO) based
on previous RTTs
• Specific method is call adaptive retransmission
algorithm
TCP/IP: Basics
24
TCP Sliding Window
• TCP uses sliding window for flow control.
• Receiver specifies window:
– Called window advertisement
– Specifies which bytes in the data stream can be sent
– Carried in segment along with ACK
• Sender can transmit any bytes, in any size
segment, between last acknowledged byte and
within window size.
TCP/IP: Basics
25
TCP Sliding Window
TCP/IP: Basics
26
TCP Sliding Window with Acknowledgements
TCP/IP: Basics
27
Congestion Control
• Excessive traffic can cause packet loss.
– Transport protocols respond with retransmission.
– Excessive retransmission can cause congestion
collapse.
• TCP interprets packet (segment) loss as an
indicator of congestion.
• Sender uses TCP congestion control and slows
transmission of packets when a packet is lost.
– Sends single packet.
TCP/IP: Basics
28
Congestion Control
– If ACK returns without loss, sends two packets, and if
two ACKs return, sends four packets, and so on,
doubling each time until….one half window size.
– When TCP sends one-half window size, rate of increase
slows.
TCP/IP: Basics
29
Summary
• UDP provides end-to-end best-effort message
delivery
– IP used for delivery to destination host
– Protocol ports demultiplex to destination application
• TCP provides end-to-end reliable byte stream
delivery
– IP used for delivery to destination host
– Protocol ports demultiplex to destination application
– Additional techniques develop reliable delivery from IP
messages.
TCP/IP: Basics
30
Summary
• Positive acknowledgment with
retransmission
• Sequence numbers detect missing, duplicate
and out-of-order data
• Sliding window flow control
• Three-way handshake
• Congestion control
TCP/IP: Basics
31