McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Transmission Control Protocol (TCP)

32
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000 Transmission Control Protocol (TCP)

Transcript of McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Transmission Control Protocol (TCP)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Transmission Control Protocol

(TCP)

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Position of TCP in TCP/IP protocol suite

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

TCPTCP• TCP is a connection-oriented protocol, it TCP is a connection-oriented protocol, it

creates a virtual connection between two TCPs creates a virtual connection between two TCPs to send data.to send data.

• TCP uses flow and error control mechanisms TCP uses flow and error control mechanisms at the transport level. at the transport level.

• It adds connection-oriented and reliability features to the services of IP.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

TCP Services

• Process-to-Process Communication.

• Stream Delivery Service.

• Full-Duplex Communication.

• Connection-Oriented Service.

• Reliable Service.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

TCP ServicesProcess-to-Process Communication

Like UDP, TCP provides process-to-process communication using port numbers.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Well-known ports used by TCP

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

PROCESS TO

PROCESSCOMMUNICATION

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 12-2

TCP versus IP

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 12-3

Port numbers

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

TCPSERVICES

12.212.2

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 12-4

Stream delivery

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

TCP Services

Stream Delivery Service ‘Sending and

receiving buffers’

• TCP needs buffers for storagethe sending and the receiving processes may not

write or read data at the same speed.

• There are the sending buffer and the receiving buffer, one for each direction.

• It is necessary for flow and error control mechanisms.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 12-5

Sending and receiving buffers

Stream of bytes

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

TCP Services Stream Delivery Service ‘TCP segments’

• The IP layer, as a service provider for TCP, needs to send data in packets, not as a stream of bytes.

• At the transport layer, TCP groups a number of bytes together into a packet called a segment.

• TCP adds a header to each segment (for control purposes) and delivers the segment to the IP layer for transmission.

• The segments are encapsulated in IP datagrams and transmitted.

• the segments are not necessarily the same size.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 12-6

TCP segments

Segment 1

H

Segment N

H

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

NUMBERINGBYTES

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

The bytes of data being transferred The bytes of data being transferred in each connection are numbered by TCP. in each connection are numbered by TCP.

The numbering starts with The numbering starts with a randomly generated number.a randomly generated number.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Example 1Example 1

Suppose a TCP connection is transferring a file of 5,000 bytes. The first byte is numbered 10,001. What are the sequence numbers for each segment if data are sent in five segments, each carrying 1,000 bytes?

SolutionThe following shows the sequence number for each segment:

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

SolutionSolution

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

The value of the sequence number field in a segment defines the number

of the first data byte contained in that segment.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 12-7

Sender buffer

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 12-19

TCP segment format

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 12-20

Control field

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Urgent Pointer

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

TCPOPERATION

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 12-33

Encapsulation and decapsulation

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Figure 12-34

Multiplexing and demultiplexing

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

TCP Connection

• In TCP, connection-oriented transmission requires three phases:

1. connection establishment.

2. data transfer.

3. and connection termination.

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

TCP Connection

Connection establishment:

• Three-way Handshaking

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Three-way Handshaking

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Three-way hand-shake

McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000

Check Sum(TCP Header)