TransmissionControlProtocol - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

TransmissionControlProtocol

Description:

Stream-oriented buffered in-order data transfer (unstructured, ... Guessable ISN is a security vulnerability. SJSU. TCP Connection Close. Closing a connection: ... – PowerPoint PPT presentation

Number of Views:17
Avg rating:3.0/5.0
Slides: 17
Provided by: frank135
Category:

less

Transcript and Presenter's Notes

Title: TransmissionControlProtocol


1
TransmissionControlProtocol
  • Transport layer (Layer 4)
  • End-to end connection setup (one sender, one
    receiver)
  • Stream-oriented buffered in-order data transfer
    (unstructured, pipelined, multi-segment)
  • Reliable, virtual circuit connection, end-to-end
    service (using ack, retransmit to deal with lost,
    delayed, duplicate, or mis-ordered packets)
  • Efficient flow control
  • Full-duplex data flow in same connection

2
TCP Connection
  • A virtual circuit
  • A pair of sockets one client and one server
  • Sockets (ip address port number)
  • Servers use well-known port numbers (lt 1K) for
    standardized services (Listen)
  • FTP (21), FTP-Data (20), Telnet (23), SMTP (25),
    HTTP (80), HTTPS(443)
  • Client ask operating system to assign an unused,
    unreserved port number (gt48K) ephemeral port,
    before making a connection (Connect)
  • Client and Server is usually a multi-to-one
    mapping
  • Chance of collision is almost zero

3
TCP Connection Establishment3-way handshake
4
listen
connect
simultaneous open
5
Reliable Data Transfer
  • PAR - Positive Acknowledgement and Retransmission
  • sends one packet, starts a timer, and waits for
    an acknowledgment before sending a new packet
  • stop and wait protocol, one packet at a time
  • Fixed Size Sliding Window
  • usually in packet level
  • efficiency (compare to PAR)
  • Retry method
  • Go back N
  • Selective Repeat

Efficiency issue
6
TCP buffers seq. s and ACKs
  • Seq. s
  • byte stream number of first byte in segments
    data
  • ACKs
  • seq of next byte expected from other side
  • cannot advance window even when one segment in
    the window is lost
  • cumulative ACK
  • Q how receiver handles out-of-order segments
  • A TCP spec doesnt say, - up to implementor

Host B
Host A
Seq33, data 100 bytes
ACK133
Seq133, data50 bytes
ACK183
7
FULL Duplex Tx/Rx buffers
Client Tx
Server Rx
Sequence data
CTxSeq
ack
Sequence data
ack
Sequence data
Server Tx
Client Rx
ack
STxSeq
8
Piggyback Tx/Rx buffer pointers
Client Tx
Server Rx
SYN with CTxSeq (7)
CTxSeq
SYN with STxSeq (25)ACK with CTxSeq1 (8)
Server Tx
ACKwith STxSeq1 (26)
Client Rx
STxSeq
All sequence numbers have been established. Both
sides are ready for data transfers.
9
TCP Sliding Window efficient transmission and
flow control
Who controls the flow?
  • Variable Size Sliding Window
  • Byte level end to end control (4 sliding windows
    per connection)
  • Allow sending multiple packets before an ack
  • Receiver specifies the current window size
    (available empty buffers) in every packet
    window advertisement
  • Initial window sizes are indicated at connection
    setup, but might vary throughout the data
    transfer to provide flow control. For example, a
    window size of zero means send no data

Offered window (advertised by receiver)
sent ack
Sent, no ack
ok2sent
wait
10
Efficient Acknowledgement
  • Delayed Acknowledgement
  • hoping ack can piggyback with the data
  • receive seg, delay 200ms, ack the segment
  • can not delay more than 500 ms (avoid
    retransmission)
  • ack at least every other data segment (for RTT
    estimates)
  • most implementations use a periodic 200-ms clock,
    the delay is actually random
  • Delay allows cumulative efficiency
  • less traffic
  • easy to generate and unambiguous
  • loss of ack does not force retransmission
  • - loss a seg, then resend all following segs
  • - inaccurate RTT estimate

11
TCP Header Pseudo Header
URG Urgent pointer field is valid ACK
Acknowledgement field is valid PSH Force
delivery RST Reset the connection SYN Synchronize
sequence numbers FIN
First Sending byte index
Next Receiving byte index(forward
acknowledgement)
Receiving buffer size
out-of-band control info location
With Pseudo header, REQUIRED
MaxSegSize, default 536, typical 1024
12
TCP segment structure
URG urgent data (generally not used)
counting by bytes of data (not segments!)
ACK ACK valid
PSH push data now (generally not used)
bytes rcvr willing to accept
RST, SYN, FIN connection estab (setup,
teardown commands)
Internet checksum (as in UDP)
13
Some Header Fields
  • Urgent out-of-band control (ctl-c), or
    data-mark interpretation
  • Segment contains pointer to last octet of urgent
    data
  • Urgent data can be retransmitted
  • Receiving TCP should deliver urgent data to
    application immediately upon receipt
  • Push send it now, both tx and rx
  • Reset abort
  • MSS Maximum Segment Size
  • MSS gt MTU fragmentation
  • MSS small overhead
  • MSS min(MTU)
  • Path MTU is not easily known to TCP app
  • Dynamic route change
  • Lower-level options (e.g. IP header options)
  • Initial Sequence Number
  • Randomly determined at the connection setup time
    by each machine
  • Guessable ISN is a security vulnerability

14
TCP Connection Close
  • Closing a connection
  • client closes socket clientSocket.close()
  • Step 1 client end system sends TCP FIN control
    segment to server
  • Step 2 server receives FIN, replies with ACK.
    Closes connection, sends FIN.
  • Step 3 client receives FIN, replies with ACK.
  • Enters timed wait - will respond with ACK to
    received FINs
  • Step 4 server, receives ACK. Connection closed.

15
TCP Connection Termination
Reasons1. retransmit final ACK(client timeout,
rx FIN)2. socket can not be reused3. drain
delayed segments
16
listen
connect
app close
half close
app close
simultaneous close
half close
17
Comparison Of UDP and TCP
  • TCP
  • between apps. and IP
  • packet called segments
  • reliable
  • checksum required
  • connection-oriented
  • stream interface
  • useful over WAN or LAN
  • flow control
  • 1-to-1
  • unicast only
  • UDP
  • between apps. and IP
  • packets called datagrams
  • unreliable
  • checksum optional
  • connectionless
  • record boundaries
  • intended for LAN
  • no flow control
  • 1-to-1, 1-many, many-1
  • allows unicast, multicast or broadcast
  • Around 95 of all bytes and around 85-95 of all
    packets on the Internet are transmitted using TCP.
Write a Comment
User Comments (0)
About PowerShow.com