Chapter 12 Transmission Control Protocol (TCP) - PowerPoint PPT Presentation

About This Presentation
Title:

Chapter 12 Transmission Control Protocol (TCP)

Description:

We can use the grep utility to extract the line corresponding to the desired application. ... grep ftp /etc/services. ftp-data 20/tcp. ftp-control 21/tcp ... – PowerPoint PPT presentation

Number of Views:90
Avg rating:3.0/5.0
Slides: 49
Provided by: dpnmPos
Category:

less

Transcript and Presenter's Notes

Title: Chapter 12 Transmission Control Protocol (TCP)


1
Chapter 12 Transmission Control Protocol (TCP)
Mi-Jung Choi Dept. of Computer Science and
Engineering mjchoi_at_postech.ac.kr
2
Contents
  • 12.1 TCP SERVICES
  • 12.2 TCP FEATURES
  • 12.3 SEGMENT
  • 12.4 A TCP CONNECTION
  • 12.5 STATE TRANSITION DIAGRAM
  • 12.6 FLOW CONTROL
  • 12.7 ERROR CONTROL
  • 12.8 CONGESTION CONTROL
  • 12.9 TCP TIMERS
  • 12.10 OPTIONS
  • 12.12 TCP PACKAGE

3
Objectives
  • Be able to name and understand the services
    offered by TCP
  • Understand TCPs flow and error control and
    congestion control
  • Be familiar with the fields in a TCP segment
  • Understand the phases in a connection-oriented
    connection
  • Understand the TCP transition state diagram
  • Be able to name and understand the timers used
    in TCP
  • Be familiar with the TCP options

4
TCP/IP Protocols
5
TCP/IP Functions
  • To create a process-to-process communication
    (using port numbers)
  • To create a flow control mechanism at the
    transport level (using sliding window)
  • To create a error control mechanism at the
    transport level (using Ack packet, time-out,
    retransmission)
  • Sequence control mechanism
  • A connection oriented, reliable transport
    protocol

6
12.1 TCP SERVICES
  • We explain the services offered by TCP to the
    processes at the application layer
  • The topics discussed in this section include
  • Process-to-Process Communication
  • Stream Delivery Service
  • Full-Duplex Communication
  • Connection-Oriented Service
  • Reliable Service

7
Process-to-Process Communication
  • For client/server communication
  • we must define the
  • Local host
  • Local client program
  • Remote host
  • Remote server program

8
PROCESS-TO-PROCESS COMMUNICATION (cont.)
  • Port numbers
  • mentioned in UDP chapter

9
PROCESS-TO-PROCESS COMMUNICATION (cont.)
  • Well-known port in TCP

Port Protocol Description
7 Echo Echoes a received datagram back to the sender
9 Discard Discards any datagram that is received
11 Users Active users
13 Daytime Returns the date and the time
17 Quote Returns a quote of the day
19 Chargen Returns a string of characters
20 FTP,data File transfer Protocol for data
21 FTP,control File transfer Protocol for control
23 TELNET Terminal Network
25 SMTP Simple Mail Transfer Protocol
53 DNS Domain Name Server
67 BOOTP Bootstrap protocol
79 Finger finger
80 HTTP Hypertext Transfer Protocol
111 RPC Remote Procedure Call
10
Example 1
As we said in Chapter 11, in UNIX, the well-known
ports are stored in a file called /etc/services.
Each line in this file gives the name of the
server and the well-known port number. We can use
the grep utility to extract the line
corresponding to the desired application. The
following shows the ports for FTP.
grep ftp /etc/services ftp-data
20/tcpftp-control 21/tcp
11
PROCESS-TO-PROCESS COMMUNICATION (cont.)
  • Socket addresses
  • a combination of IP address and port number
  • to make a connection for each end
  • to need a pair of socket addresses client and
    server socket address
  • These four pieces of information are part of the
    IP header (IP address) and TCP header (port
    number)

12
12.1 TCP SERVICES (cont.)
  • Stream delivery service
  • Sending and receiving buffers
  • Segments
  • Full-Duplex service
  • piggybacking
  • Connection-Oriented service
  • A virtual connection (not physical connection)
  • Reliable service
  • Reply acknowledge packet

13
Stream delivery
  • Sending TCP
  • receives data as a stream of bytes from
    application process using sending buffer
  • make data to appropriate segments and transfer
    to network
  • Receiving TCP
  • receives segments using receiving buffer
  • reassemble segments to data and send data as
    a stream of bytes to application process

14
Sending and receiving buffers
  • The sending process and the receiving process may
    not produce and consume data at the same speed,
    TCP needs buffers for storage

15
TCP segments
  • IP layer, as a service provider for TCP, needs to
    send data in packets, not as a stream of bytes.
  • TCP groups a number of bytes together into a
    packet called segment

16
UDP vs. TCP communication
17
12.2 TCP FEATURES
  • To provide the services mentioned in the
    previous section, TCP has several features that
    are briefly summarized in this section.
  • The topics discussed in this section include
  • Numbering System
  • Flow Control
  • Error Control
  • Congestion Control

18
Numbering system
  • TCP keeps track of the segment being transmitted
    or received using sequence number and acknowledge
    number
  • These number is used for flow and error control
  • The bytes of data being transferred in each
    connection are numbered by TCP
  • The numbering starts with a randomly generated
    number (b/w 0 232-1)

19
Numbering system
  • When TCP receives bytes of data from the process
    and stores them in sending buffer
  • After numbering the bytes, TCP assigns sequence
    number to each segment that is being sent
  • The value of the sequence number field in a
    segment defines the number of the first data byte
    contained in that segment
  • The value of the acknowledgment field in a
    segment defines the number of the next byte a
    party expects to receives. The acknowledgment
    number is cumulative

20
Example 2
  • Suppose a TCP connection is transferring a file
    of 5000 bytes. The first byte is numbered 10001.
    What are the sequence numbers for each segment if
    data is sent in five segments, each carrying 1000
    bytes?
  • Solution
  • The following shows the sequence number for each
    segment
  • Segment 1 ? Sequence Number 10,001 (range
    10,001 to 11,000)
  • Segment 2 ? Sequence Number 11,001 (range
    11,001 to 12,000)
  • Segment 3 ? Sequence Number 12,001 (range
    12,001 to 13,000)
  • Segment 4 ? Sequence Number 13,001 (range
    13,001 to 14,000)
  • Segment 5 ? Sequence Number 14,001 (range
    14,001 to 15,000)

21
12.3 SEGMENT
A packet in TCP is called a segment
The topics discussed in this section include
  • Format
  • Encapsulation

22
12.3 SEGMENT
  • The unit of data transfer b/w 2 devices using TCP
    is a segment

23
12.3 SEGMENT (cont.)
  • Segment
  • source port address the port number of the
    application program in the senders host
  • destination port address the port number of the
    application program in the receivers host
  • sequence number the number of the 1st byte of
    data in this segment
  • acknowledgement number the byte number that the
    receiver is expecting to receive from the other
    party
  • header length 4 bytes
  • control
  • window size 16 bits
  • checksum all segment including pseudo-header
  • urgent pointer
  • option

24
12.3 SEGMENT (cont.)
  • Control

25
12.3 SEGMENT (cont.)
  • Control
  • URG ?? ???? ???
  • ACK ?? ?? ??? ???
  • PSH ???? ???? ??? ?? ???? ??? ?
  • RST ??? ???
  • SYN ??? ????? ?? ?? ??? ???
  • FIN ???? ??? ??? ???

26
Pseudoheader added to the TCP datagram
The inclusion of the checksum in TCP is mandatory
27
Encapsulation and decapsulation
28
12.4 TCP CONNECTION
  • TCP is connection-oriented. A connection-oriented
    transport protocol establishes a virtual path
    between the source and destination. All of the
    segments belonging to a message are then sent
    over this virtual path. A connection-oriented
    transmission requires three phases connection
    establishment, data transfer, and connection
    termination.
  • The topics discussed in this section include
  • Connection Establishment
  • Data Transfer
  • Connection Termination
  • Connection Reset

29
12.4 TCP CONNECTION
  • TCP connection oriented
  • Establishment the VC b/w source TCP and
    destination
  • Connection establishment and termination
  • Connection establishment
  • 3 ?? ??
  • ??? A? ??? B?? ?? ?? ????? ??(??? ??)
  • ??? B? ??? A?? ???? ???? ? ??? ?? ???? ??
  • ??? A? ??? B?? ???? ???? ??
  • Connection termination
  • 4?? ??
  • ??? A? ?? ??? ??? ???? ??
  • ??? B? A? ??? ?? ?? ???? ???? ??
  • ??? B? ?? ??? ??? ???? ??
  • ??? A? B? ??? ?? ????

30
Connection establishment using three-way
handshaking
31
Connection establishment using three-way
handshaking
  • A SYN segment cannot carry data, but it consumes
    one sequence number.
  • A SYN ACK segment cannot carry data, but does
    consume one sequence number.
  • An ACK segment, if carrying no data, consumes no
    sequence number.

32
Data transfer
The FIN segment consumes one sequence number if
it does not carry data
33
Connection termination using three-way handshaking
The FIN ACK segment consumes one sequence
number if it does not carry data
34
Half Close
  • One end stops sending data while still receiving
    data.
  • Normally initiated by client.
  • It can occur when the server needs all data
    before processing can begin
  • Sorting example
  • The client, after sending all data to be sorted,
    can close the connection in the outbound
    direction.
  • However, the inbound direction must remain open
    to receive the sorted data.

35
Connection Reset
  • The TCP at end may deny a connection request, may
    abort a connection, or may terminate an idle
    connection. All of these are done with the RST
    (reset) flag.
  • Denying a connection
  • Aborting a connection
  • Terminating an idle connection

36
12.5 STATE TRANSITION DIAGRAM
To keep track of all the different events
happening during connection establishment,
connection termination, and data transfer, the
TCP software is implemented as a finite state
machine.
The topics discussed in this section include
  • Scenarios

37
12.5 STATE TRANSITION DIAGRAM
  • finite state machine
  • At any moment, the machine is in one of the state
  • TCP states

38
STATE TRANSITION DIAGRAM
- state ovals - Transition from one to another
state directed line - values on line input
/ output - Dotted line server - Solid line
client - Thin line unusual situation
39
Connection scenario
The common value for MSL (Maximum Segment
Lifetime) is between 30 seconds and 1 minute
40
STATE TRANSITION DIAGRAM
Client states
Server states
41
Connection termination using three-way handshake
42
Simultaneous Open
43
Simultaneous Close
44
Denying a Connection
45
Aborting a connection
46
TCP OPERATION
  • Encapsulation and decapsulation

47
TCP OPERATION (cont.)
  • Buffering

48
TCP OPERATION (cont.)
  • Multiplexing and demultiplexing
Write a Comment
User Comments (0)
About PowerShow.com