TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
-
date post
21-Dec-2015 -
Category
Documents
-
view
238 -
download
1
Transcript of TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
- TCP passed block of data to IP, consisting of the TCP header and application layer data, called segment- Stream of octets passed between sender/ receiver Deliver in same octate sequence- Connection-oriented service - Full duplex - Reliable service
byte stream
Send buffer
segments
Receive buffer
byte stream
Application Application
ACKs
Transmitter Receiver
TCP: Overview
TCP Segment
Source Port Destination Port
Sequence Number
Acknowledgement Number
Checksum Urgent Pointer
Options Padding
0 4 10 16 24 31
URG
ACK
PSH
RST
SYN
FIN
HeaderLength Reserved Window Size
Data
• Source, Destination port: 16 bits - identify applications at ends of the connection
• Client Program allocates a port (usually above 1023)
• Servers are known by ports number - FTP 20, TELNET 23, SMTP 25, HTTP 80
• Port numbers are generally allocated by -- 0 -- not used -- 1- 255 -- Reserved ports for well- known services -- 256- 1023 -- Other reserved ports -- 1024- 65535 -- user- defined server ports
• Unix store general used ports in /etc/ services
TCP header fields
Socket
• Connection identification by 5 tuple --- 2 IP address, 2 port, protocol number (TCP=6) -- Socket
• IP address is unique to a node, the port is unique on a node
• A connection is identified by the socket address at its to ends: - client socket: 158. 108.33. 3, 3000; 158.108.2.71,21 - server socket: 158.108.2.71,21; 158.108.33.3,3000;
Socket: Multiple connection
• Server’s unique socket address can be accessed simultaneously by clients
TCP: Reliable Transport
• Send and wait for acknowledgment with sequence number ---sender reset timer when receives ACK
• No ACK within a certain time, retransmit the packet
---Error Recovery
TCP: Reliable Transport
Set the appropriate size of sliding window size adaptively
• Use for flow control : - Prevent sender from overloading receiver with data, e. g. high- performance server to slow PC - Congestion inside network, e. g. router performance, slow link speed
• How to provide flow control?
• Receiver “ advertises” it’s windows size in acknowledgments - Window size specifies how many bytes the receiver is willing to accept - Limited by congestion window
• Sender will adjusts buffer pointer as receiver’s advertisement
Sliding window/ Transmission window
• A larger window size allows more data to be transmitted with pending acknowledgment
• Need not to wait for acknowledgment every segment
Connection Concept
• Before data could be transferred, a connection must be opened ---servers do passive open (listen) ---clients do active open (connect)
• When it finished, the connection is closed
• TCP has general 3 phases -- connection setup phase -- data phase -- connection close phase
• Socket is stored in „TCP control block“ TCB - with sequence number and timer values
3-way Handshake for connection establishment
Host A Host B
SYN, Seq_no = x
SYN, Seq_no = y, ACK, Ack_no = x+1
Seq_no = x+1, ACK, Ack_no = y+1
Active open
Closed
Listen
Established
Established
Seq_no = 2000, Ack_no = 1, Win = 1024, Data = 2000-3023
Seq_no = 1, Ack_no = 4048, Win = 512, Data = 1-128
Seq_no = 3024, Ack_no = 1, Win = 1024, Data = 3024-4047
Seq_no = 4048, Ack_no = 129, Win = 1024, Data = 4048-4559
t1
t2
t3
t4
Seq_no = 1, Ack_no = 2000, Win = 2048, No Data t0
TCP Window control
FIN, seq = 5086
ACK = 5087
Data, seq. = 303, ACK = 5087Deliver 150 bytes
FIN, seq. =453, ACK = 5087
ACK = 454
Host B
ACK = 453
Connection Termination
Host A