Reliable ByteStream TCP - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Reliable ByteStream TCP

Description:

?????????????????????????????? (End-to-End Protocols) ... Karn/Partridge Algorithm. ????????????????? RTT ?????????? retransmitting ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 28
Provided by: klp169
Category:

less

Transcript and Presenter's Notes

Title: Reliable ByteStream TCP


1
Reliable Byte-Stream (TCP)
  • ???????????????
  • Connection Establishment/Termination
  • Sliding Window
  • Flow Control
  • Adaptive Timeout

2
??????????????????????????????(End-to-End
Protocols)
  • ??????????????????????????????????? best-effort
    network
  • ???????????????????
  • ????????????????????????
  • ???????????????????????
  • ??????????????????????
  • ???????????????????????????????????

3
???????????? ??????????????????????????????
  • ?????????????????????
  • ????????????????? ??????????????????????
  • ????????????????????????????????
  • ??????????????????????????????????
  • ????????? synchronization
  • ??????????????????????????????????????????????????
    ????
  • ??????????????????????????? ???????????

4
UDP
  • ????????? datagram ???????????????????????
    ??????????????????
  • ???????? multiplexing ??????
  • ??????????????????????????????????????????????????
    ????
  • ?????????? ports ???????????????
  • ????? servers ???? well-known ports
  • ?????? Unix ??????????????????? /etc/services
  • ????????? Header
  • checksum (??????????????????)
  • psuedo header UDP header data

0
16
31
SrcPort
DstPort
Checksum
Length
Data
5
IANA Dynamic or Private
IANA Well Known
IANA Registered Ports
1
1023
1024
49151
49152
65535
BSD Reserved
BSD ephemeral
BSD Servers (nonprivileged)
1
1023
1024
5000
5001
65535
6
application
Application buffer (any size)
sendto
user process
kernel
Socket send buffer (SO_SNDBUF)
UDP
UDP Datagram
IP
Fragmentation
MTU-sized IPv4 or IPv6 packets
output queue
DATA LINK
7
TCP
  • ???????????? (Full duplex)
  • ?? Flow control ??????????????????????????????????
    ??????????????????
  • Congestion control ??????????????????????????????
    ?????????????????????????
  • Connection-oriented
  • Byte-stream
  • ????????????? bytes
  • TCP ??? segments
  • ????????????? bytes

8
??????????? Data Link ??? Transport
  • ??????????????????????????????????????
  • ????????????????? connection establishment ???
    termination
  • RTT ?????????????????????????????
  • ?????????????????????? timeout ???
    Adaptivemechanism
  • ?????????????????????
  • ???????????????????????????????????????
  • ????????????????????????????????????????????????
  • ????????????????????????????????????????????
  • ????????????????????????????????????????????
  • ???????????????????????? network congestion

9
?????? Segment
10
?????? Segment (???)
  • ???????????????????????????????????
  • (SrcPort, SrcIPAddr, DsrPort, DstIPAddr)
  • Sliding window flow control
  • acknowledgment, SequenceNum, AdvertisedWinow
  • Flags
  • SYN, FIN, RESET, PUSH, URG, ACK
  • Checksum
  • pseudo header TCP header data

11
Connection Establishment ???Termination
Active participant
Passive participant
(client)
(server)
SYN, SequenceNum
x
,
y
1

SYN ACK, SequenceNum
x
Acknowledgment
ACK, Acknowledgment
y

1
12
State Transition Diagram
13
CLOSED
Appl. passive open Send Nothing
Appl. active open Send SYN
Client Server
passive open
LISTEN
Appl. close or timeout
active open
Recv SYN send SYN, ACK
Recv RST
Recv SYN Send SYN, ACK simultaneous open
SYN_SENT
SYN_RCVD
Recv SYN, ACK send ACK
Recv ACK Send Nothing
ESTABLISH
Data transfer state
Recv FIN Send ACK
CLOSE_WAIT
Simultaneous close
Recv FIN Send ACK
FIN_WAIT_1
CLOSING
Appl. close Send FIN
Recv ACK Send Nothing
Recv FIN, ACK Send ACK
Recv ACK Send Nothing
Recv ACK Send Nothing
LAST_ACK
Recv FIN Send ACK
TIME_WAIT
FIN_WAIT_2
Passive close
Active close
14
TCP Three-way Handshake
client
server
Socket, bind, listen accept (blocks)
Socket connect (blocks) (active open)
SYN J
SYN K, ack J1
connect return
ack K1
Accept returns read (blocks)
15
TCP Connection Termination
client
server
close() (active close)
FIN M
(passive close) read return 0
ack M1
FIN N
ack N1
16
client
server
SYN J MSS1460
Socket, bind, listen accept (blocks) LISTEN
Socket connect (blocks) (active open) SYN_SENT
SYN K, ack J1 mss1024
SYN_RCVD
ESTABLISHED
ack K1
connect return
ESTABLISHED
Accept returns read (blocks)
Data (request)
Write read(block)
Data (reply) Ack of request
Write read (blocks)
Ack of reply
close() (active close) FIN_WAIT_1
FIN M
CLOSE_WAIT (passive close) read return 0
ack M1
FIN_WAIT_2
FIN N
Close LAST_ACK
ack N1
TIME_WAIT
CLOSED
17
application
Application buffer (any size)
write
User process
kernel
Socket send buffer (SO_SNDBUF)
TCP
MSS-sized TCP Segment (SO_SNDBUF)
MSS normally lt MTU - 40 (IPv4) or MTU -60 (IPv6)
IP
MTU-sized IPv4 or IPv6 packets
output queue
DATA LINK
18
Sliding Window
  • ??????? Sending
  • LastByteAcked lt LastByteSent
  • LastByteSent lt LastByteWritten
  • ????? buffer ????????????? LastByteAcked ???
    LastByteWritten
  • ??????? Receiving
  • LastByteRead lt NextByteExpected
  • NextByteExpected lt LastByteRcvd 1
  • ????? buffer ????????????? NextByteRead ???
    LastByteRcvd

19
?????????????????????
  • ???? Send buffer MaxSendBuffer
  • ???? Receive buffer MaxRcvBuffer
  • ??????? Receiving
  • LastByteRcvd - LastByteRead lt MaxRcvBuffer
  • AdvertisedWindow MaxRcvBuffer - (LastByteRcvd -
    NextByteRead)
  • ??????? Sending side
  • LastByteSent - LastByteAcked lt
    Adver?tisedWindow
  • EffectiveWindow AdvertisedWindow -
    (LastByteSent - LastByteAcked)
  • LastByteWritten - LastByteAcked lt MaxSendBuffer
  • block sender if (LastByteWritten - LastByteAcked)
    y gt MaxSenderBuffer
  • ??? ACK ??????????? data segment ????
  • ????? AdvertisedWindow 0, ??????????????????????
    ????

20
???????????????????????????????? Sequence Number
  • 32-bit SequenceNum
  • Bandwidth Time Until Wrap Around
  • T1 (1.5 Mbps) 6.4 hours
  • Ethernet (10 Mbps)57 minutes
  • T3 (45 Mbps) 13 minutes
  • FDDI (100 Mbps) 6 minutes
  • STS-3 (155 Mbps) 4 minutes
  • STS-12 (622 Mbps) 55 seconds
  • STS-24 (1.2 Gbps) 28 seconds

21
?????????????????????
  • 16-bit AdvertisedWindow
  • Bandwidth Delay x Bandwidth Product
  • T1 (1.5 Mbps) 18KB
  • Ethernet (10 Mbps)122KB
  • T3 (45 Mbps) 549KB
  • FDDI (100 Mbps) 1.2MB
  • STS-3 (155 Mbps) 1.8MB
  • STS-12 (622 Mbps) 7.4MB
  • STS-24 (1.2 Gbps) 14.8MB

22
??????????????? TCP
  • ????????????????? header options
  • ???? timestamp ?????? segments ?????????
  • ??????????? sequence space ???? 32-bit timestamp
    (PAWS)
  • Shift (scale) advertised window

23
Adaptive Retransmission
  • ??? SampleRTT ??????????? segment/ACK
  • ????????????????? RTT
  • EstRTT a x EstimatedRTT b x SampleRTT
  • ????? a b 1
  • a ??????????? 0.8 ??? 0.9
  • b ??????????? 0.1 ??? 0.2
  • ??? timeout ????????? EstRTT
  • TimeOut 2 x EstRTT

24
Karn/Partridge Algorithm
Sender
Receiver
Sender
Receiver
Original transmission
Original transmission
TT
TT
ACK
Retransmission
SampleR
SampleR
Retransmission
ACK
  • ????????????????? RTT ?????????? retransmitting
  • ???????? timeout ?????????????????????
    retransmission

25
Jacobson/ Karels Algorithm
  • Diff sampleRTT - EstRTT
  • EstRTT EstRTT ( 8 x Diff)
  • Dev Dev 8 ( Diff - Dev)
  • ????? 8 ??????? factor ??????? 0 ??? 1
  • ?????????????????????????????? timeout
  • TimeOut m x EstRTT f x Dev
  • ????? m 1 ??? f 4
  • ?????????????? algorithm ?????????????????????????
    ????????????????????????????????????? (500ms on
    Unix)
  • ?????????? timeout ???????????????????????????????
    congestion control

26
Big Picture
tcp- dump
mroute
ping
trace route
appl.
appl.
appl.
trace route
appl.
ping
TCP
UDP
ICMP
IPv4
IGMP
ICMPv6
IPv6
ARP RARP
data-link
BPF DLPI
27
  • IPv4 Internet Protocol version 4
  • IPv6 Internet Protocol version 6
  • TCP Transmission Control Protocol
  • UDP User Datagram Protocol
  • ICMP Internet Control Message Protocol
  • IGMP Internet Group Management Protocol
  • ARP Address Resolution Protocol
  • RARP Reverse Address Resolution Protocol
  • ICMPv6 Internet Control Message Protocol, version
    6
  • BPF BSD Packet Filter
  • DLPI Data Link Provider Interface
Write a Comment
User Comments (0)
About PowerShow.com