Transmission Control Protocol TCP - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Transmission Control Protocol TCP

Description:

It has Interfaces to the IP layer. It Manages TCP streams. Accepts user data, breaks it down and sends it as separate IP datagrams. ... – PowerPoint PPT presentation

Number of Views:60
Avg rating:3.0/5.0
Slides: 23
Provided by: kevinc3
Category:

less

Transcript and Presenter's Notes

Title: Transmission Control Protocol TCP


1
Transmission Control Protocol (TCP)
2
TCP
  • TCP is a Reliable end-to-end communication.
  • There is a TCP transport entity
  • It runs on machine that supports TCP.
  • It has Interfaces to the IP layer.
  • It Manages TCP streams.
  • Accepts user data, breaks it down and sends it
    as separate IP datagrams.
  • At receiver, reconstructs original byte stream
    from IP datagrams.

3
TCP Reliability Service
  • On of TCPs main characteristics is that it
    imposes reliable delivery on the stream.
  • It does this with ACKs and Timeouts and
    retransmissions.
  • It also provides Ordered delivery.
  • TCP Service Model - Obtained by creating TCP end
    points.
  • Example UNIX sockets.
  • TSAP address
  • IP address 16-bit port number.
  • Multiple connections can share same port pair.
  • Port numbers below 1024 well-known ports
    reserved for standard services.
  • List of well-known ports in RFC 1700.

4
TCP Service Model .
  • TCP connections are full-duplex and
    point-to-point.
  • Byte stream (not message stream).
  • Message boundaries are not preserved e2e.

A B C D
A
B
C
D
4 512-byte segments sent as separate IP datagrams
2048 bytes of data delivered to application in
single READ
5
TCP Byte Stream
  • When application passes data to TCP, it may send
    it immediately or buffer it.
  • Sometimes application wants to send data
    immediately such as interactive applications.
  • Here - Use PUSH flag to force transmission.
  • URGENT flag.
  • Also forces TCP to transmit at once.

6
TCP Protocol Overview
  • TCPs TPDU segment.
  • 20-byte header options.
  • Data.
  • TCP entity decides the size of segment.
  • 2 limits 64KByte IP payload and MTU.
  • Segments that are too large are fragmented.
  • More overhead by addition of IP header.
  • Sequence numbers.
  • Reliability, ordering, and flow control.
  • Assigned to every byte.
  • 32-bit sequence numbers.

7
TCP Segment Header
Source port
Destination port
Sequence number
Acknowledgment number
Header length
A
Window size
P
R
S
F
U
Checksum
Urgent pointer
Options (0 or more 32-bit words)
Data
8
TCP Header Fields
  • Source and destination ports identify connection
    end points.
  • Sequence number.
  • Acknowledgment number specifies next byte
    expected.
  • TCP header length how many 32-bit words are
    contained in header.
  • 6-bit unused field.
  • 6 1-bit flags
  • URG indicate urgent data present urgent
    pointer gives byte offset from current sequence
    number where urgent data is.
  • ACK indicates whether segment contains
    acknowledgment if 0, acknowledgement number
    field ignored.
  • PUSH indicates PUSHed data so receiver delivers
    it to application immediately.

9
.TCP Header Fields
  • Flags (contd)
  • RST used to reset connection, reject invalid
    segment, or refuse to open connection.
  • SYN used to establish connection connection
    request, SYN1, ACK0.
  • FIN used to release connection.
  • Window size how many bytes can be sent starting
    at acknowledgment number.
  • Checksum checksums the headerdatapseudo-header.
  • Options provide way to add extra information.
  • Examples
  • Maximum payload host is willing to accept can be
    advertised during connection setup.
  • Window scale factor that allows sender and
    receiver to negotiate larger window sizes.

10
TCP Connection Setup
  • 3-way handshake.

Host 2
Host 1
SYN (SEQx)
SYN(SEQy,ACKx1)
(SEQx1, ACKy1)
11
TCP Connection Release
  • Abrupt release
  • Send RESET.
  • May cause data loss.
  • Graceful release
  • Each side of the connection released
    independently.
  • Either side send TCP segment with FIN1.
  • When FIN acknowledged, that direction is shut
    down for data.
  • Connection released when both sides shut down.

12
TCP Transmission
  • Sender process initiates connection.
  • Once connection established, TCP can start
    sending data.
  • Sender writes bytes to TCP stream.
  • TCP sender breaks byte stream into segments.
  • Each byte assigned sequence number.
  • Segment sent and timer started.
  • If timer expires, retransmit segment.
  • After retransmitting segment for maximum number
    of times, assumes connection is dead and closes
    it.

13
TCP Flow Control
  • Sliding window.
  • Receivers advertised window.
  • Size of advertised window related to receivers
    buffer space.
  • Sender can send data up to receivers advertised
    window.

14
TCP Flow Control Example
App. writes 2K of data
4K
2KSEQ0
2K
ACK2048 WIN2048
App. does 3K write
2K SEQ2048
0
Sender blocked
App. reads 2K of data
ACK4096 WIN0
2K
ACK4096 WIN2048
Sender may send up to 2K
1K SEQ4096
1K
15
TCP Flow Control Observations
  • TCP sender not required to transmit data as soon
    as it comes in form application.
  • Example when first 2KB of data comes in, could
    wait for more data since window is 4KB.
  • Receiver not required to send ACKs as soon as
    possible.
  • Wait for data so ACK is piggybacked.

16
Delayed ACKs
  • Tries to optimize ACK transmission.
  • Delay ACKs and window update (500msec) hoping to
    piggyback on data segment.
  • Example telnet to interactive editor
  • Send 1 character at a time 20-byte TCP header
    1-byte data20-byte IP header.
  • Receiver ACKs immediately 40-byte ACK.
  • When editor reads character, window update
    40-byte datagram.
  • Then echoes character back 41-byte datagram.

17
Congestion Control
  • Why do it at the transport layer?
  • Real fix to congestion is to slow down sender.
  • Use law of conservation of packets.
  • Keep number of packets in the network constant.
  • Dont inject new packet until old one leaves.
  • Congestion indicator packet loss.

18
TCP Congestion Control
  • Like, flow control, also window based.
  • Sender keeps congestion window (cwin).
  • Each sender keeps 2 windows receivers
    advertised window and congestion window.
  • Number of bytes that may be sent is
    min(advertised window, cwin).
  • Slow start Jacobson 1988
  • Connections congestion window starts at 1
    segment.
  • If segment ACKed before time out, cwincwin1.
  • As ACKs come in, current cwin is increased by 1.
  • Exponential increase.
  • Congestion Avoidance
  • Third parameter threshold.
  • Initially set to 64KB.
  • If timeout, thresholdcwin/2 and cwin1.
  • Re-enters slow-start until cwinthreshold.
  • Then, cwin grows linearly until it reaches
    receivers advertised window.

19
TCP Congestion Control Example
20
TCP Retransmission Timer
  • When segment sent, retransmission timer starts.
  • If segment ACKed, timer stops.
  • If time out, segment retransmitted and timer
    starts again.
  • How to set the Timer
  • Based on round-trip time time between a segment
    is sent and ACK comes back.
  • If timer is too short, unnecessary
    retransmissions.
  • If timer is too long, long retransmission delay.

21
Keepalive Timer
  • Goes off when a connection is idle for a long
    time.
  • Causes one side to check whether the other side
    is still alive.
  • If no answer, connection terminated.
  • TIME_WAIT
  • 2MSL.
  • Makes sure all segments die after connection is
    closed.

22
Finally.Wireless TCP
  • According to layered system design principles,
    transport protocol should be independent of
    underlying technology.
  • However, wireless networks invalidate this
    principle.
  • Ignoring properties of wireless medium can lead
    to poor TCP performance.
  • Problem TCPs congestion control.
  • Problem packet loss as congestion indicator.
  • When retransmission timer times out, sender
    slows down.
  • Wireless links are lossy!
  • Dealing with losses in this case should be
    re-sending lost segments asap.
Write a Comment
User Comments (0)
About PowerShow.com