• No results found

tcp

N/A
N/A
Protected

Academic year: 2020

Share "tcp"

Copied!
76
0
0

Loading.... (view fulltext now)

Full text

(1)

Transmission

(2)

Figure 12-1

(3)

PROCESS

TO

PROCESS

COMMUNICATION

12.1

(4)
(5)

TCP/IP Protocol Suite 5

Table 12.1

(6)

Figure 12-2

(7)

Figure 12-3

(8)

TCP

SERVICES

12.2

(9)

Figure 12-4

Stream delivery

(10)

Figure 12-5

(11)

Figure 12-6

(12)

Connection oriented service

 Two tcp’s establish a connection between them

 Data are exchanged in both direction

Connection is terminated

Reliable service

(13)

NUMBERING

BYTES

12.3

(14)

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.

(15)

Example 1

Example 1

(16)

Solution

Solution

The following shows the sequence number for each

segment:

Segment 1

10,010 (10,010 to 11,009)

Segment 2

11,010 (11,010 to 12,009)

Segment 3



12,010 (12,010 to 13,009)

Segment 4



13,010 (13,010 to 14,009)

(17)

The value of the sequence number field in

a segment defines the number

of the first data byte

(18)
(19)

Figure 12-19

(20)

Source Port address:

Port number of the application

program

Destination Port:

Port number of the application

program in the host that is receiving the segment

Sequence Number:

Defines the number assigned to

the first byte of data contained in this segment. During

connection establishment each party uses a random

number generator creates an

Initial Sequence

Number (ISN)

(21)

Header Length: Value of this field can be

between 20 and 60 bytes

•Reserved: Reserves for future use

Window Size-

Defines the size of the window in

bytes that the other party must maintain

•Max size of the window is 65,535 bytes

•Determined by the receiver

Checksum- Pseudo header ,Mandatory

(22)

Figure 12-20

(23)
(24)

CONNECTION ESTABLISHMENT

DATA TRANSFER

(25)

Three way handshaking

1. Active open

2. Passive open

3. Simultaneous open

(26)

Figure 12-28

(27)

1. SYN Segment cannot carry data but it consumes one sequence number

• This segment is for synchronization of sequence numbers

Chooses a random sequence number called ISNNo ack

2. SYN+ACK segment with two flag bits set SYN+ACK

Dual Purpose: Server uses this segment to initialize a sequence number for numbering bytes sent from the server

• Server also acknowledges the receipt of SYN segment from the client by setting the ACK flag and displays the next Sequence number it expects to receive from the client. It contains the receiver window size rwnd to be used by the client.

(28)

Connection Establishment

• 3. Just an ack Segment . It acknowledges the receipt of

the second segment with the ACK flag and

acknowledgment number field

• Sequence number in this segment is the same as the one

in the SYN segment. ACK segment does not consume

any sequence numbers

(29)

When a malicious attacker sends a large number of

SYN segments to a server pretending that each of

them is coming from a different client by faking the

source IP addresses in the datagrams. Belongs to

denial of service attack

Soln : Limit of connection request during a specific

period of time

Filters out datagrams coming from unwanted source

addresses

To postpone resource allocation until the entire

connection is set up using cookie

(30)

Figure 12-29

(31)

DATA TRANSFER

Pushing data- Sending TCP uses a buffer to store the stream of data coming from the app. Program. Receiving TCP buffers the data when they arrive and delivers them to application program when it is ready

•Ex: Consider an application program that communicates interactively with another application program. Application program on one site wants to send a keystroke to the application at the other site and receive an immediate response

•Application program at the sending site can request a push

operation. Sending TCP will not wait for the window to be filled •Sets push bit so that receiving TCP know that the segment includes data that must be delivered to the receiving application program as soon as possible

(32)

Urgent data

• Sending application pgm wants a piece of data to be read out of order by the receiving application pgm

• Ex: Sending app. Program is sending data to be processed by the receiving application program finds that everything is wrong. It wants to abort the process but it has already sent a huge amount of data.

• Soln is to send a segment with the URG bit set. Sending TCP creats a segment and inserts the urgrent data at the beginning of the segment. Urgement pointer field defines the end of the urgent data and start of normal data

(33)

Connection Termination

Three way handshaking

1. FIN segment can include the last chunk of data send by the client or it can be just a control segment

FIN segment consumes one sequence number if it does

not carry data

2. Server TCP after receiving FIN segment it sends FIN+ ACK segment to confirm the receipt of FIN segment and at the same time announce the closing of connection

FIN+ACK segment consumes one sequence number of it does not carry data

3. Client TCP sends the last segment Ack segment to confirm the receipt of FIN segment

(34)
(35)
(36)

Half Close

• One end stop sending data while still receiving data

• Eg.: When the client sends data to the server to be sorted • Client half closes the connection by sending a FIN segment

• After half closing the connection data can travel from the server to the client and acknowledgements can travel from the client to server

• Data transfer from the client to the server stops. Server can however still send data

(37)

CONNECTION RESET

 Denying a connection- Request the nonexistent port. Send a segment with its RST bit set

(38)

STATE

TRANSITION

DIAGRAM

12.13

(39)

Figure 12-30

(40)

TCP/IP Protocol Suite 40

Table 12.3

(41)

Figure 12-31

(42)

Dotted Black lines- Represents the transition that server normally goes through

Solid Black Lines- Represents the transition that client normally goes through

Connection Establishment

Client States: Client process issues a command to its TCP to request a connection to a specific socket address. This is called active open

Client : TCP sends a SYN segment

Server: TCP sends SYN+ACK segment

(43)

Client process has no more data to send it issues a cmd called an active close

Client TCP sends a FIN segment and goes to the FIN-WAIT-1 state

When it receives the ACK for the sent FIN it goes to FIN-WAIT-2 state and remains there until it receives the a FIN segment from the server

When FIN segment is received the client sends an ACK segment and goes to TIME-WAIT state and sets a timer for a time out value of twice the maximum segment lifetime (MSL)

MSL is the maximum time a segment can exist in the Internet before it is dropped

(44)

•There are 2 reasons for the existence of TIME-WAIT state and the 2 MSL timer:

1. If the last ACK segment is lost the server TCP which sets a timer for the last FIN assumes that its FIN is lost and resends it

•If the client goes to the CLOSED state and closes the connection before the 2 MSL timer expires, server never receives the final ACK. Server cannot close the connection

•2 MSL timer makes the client wait for a duration (enough time for an ACK to be lost and a FIN to arrive)

•During the TIME-WAIT state a new FIN arrives the client sends a new ACK and restarts the 2 MSL timer

(45)

•Assume a client and server have closed a connection

•After a short period of time they open a connection with

the same socket address

•This new connection is called

incarnation

of the old one

•A duplicated segment from the previous connection may

arrive in the new connection and interpreted as belonging

to new connection if there is not enough time between two

connections

(46)

Figure 12-32

(47)

Server State

•The server process issues an open command (before client open)

•Server TCP goes to the LISTEN state and remains there until it receives SYN segment

•When the server TCP receives a SYN segment it sends a SYN+ACK segment and goes to SYN-RECD state waiting for the client to send an ACK segment

•After receiving ACK segment it goes to Established state where data transfer takes place

•TCP remains there until it receives a FIN segment from the client TCP

(48)

•It then sends a FIN to the client to show that it is closing

the connection too and goes to LAST-ACK state

(49)

49

(50)

TCP/IP Protocol Suite 50

The common value for MSL is between

30 seconds and 1 minute.

Note:

(51)

FLOW

(52)

TCP/IP Protocol Suite 52

12.6 FLOW CONTROL

Flow control regulates the amount of data a source can send before

Flow control regulates the amount of data a source can send before

receiving an acknowledgment from the destination. TCP defines a window

receiving an acknowledgment from the destination. TCP defines a window

that is imposed on the buffer of data delivered from the application

that is imposed on the buffer of data delivered from the application

program.

program.

The topics discussed in this section include:

The topics discussed in this section include:

Sliding Window Protocol

Sliding Window Protocol

Silly Window Syndrome

(53)

TCP/IP Protocol Suite 53

(54)

TCP/IP Protocol Suite 54

A sliding window is used to make

transmission more efficient as well as to

control the flow of data so that the

destination does not become

overwhelmed with data.

TCP’s sliding windows are byte

oriented.

Note:

(55)

Flow Control

• Bytes inside the window are the bytes that can be in transit they can be sent without worrying about ack

• Window is opened, closed or shrunk

Opening a window moves right wall to right. This allows more new bytes in the buffer that are eligible for sending • Closing window moves left wall to right. This means

some bytes have ack and the sender need not worry anymore

(56)

Flow Control

• Size of the window at one end is determined by

the

lesser

of

two

values:

receiver

window(rwnd) or congestion window(cwnd)

Receiver window

is the value advertised by the

opposite end in a segment

• It is the number of bytes the other end can

accept before its buffer overflows

(57)

Flow Control

• Ex 1: Shows an unrealistic example

• Sent Bytes 202

• 200 to 202 are sent not ack

(58)

TCP/IP Protocol Suite 58

Figure 12.21 Example 5

Ex 1: Shows an unrealistic example Sent Bytes 202

200 to 202 are sent not ack

(59)

Flow Control

(60)

Flow Control

(61)

TCP/IP Protocol Suite 61

(62)

Flow Control

(63)

Flow Control

• How can the receiver avoid shrinking the window in the previous example

Soln:

• To avoid the shrinking the sender window the receiver must wait until more space is available in its buffer (Window Shutdown)

(64)

SILLY

(65)

Silly Window Syndrome

• Ex:If TCP sends segments containing only 1 byte of

data , it means 41 byte datagram transfers only 1

byte of user data. Here the overhead is 41/1. which

denotes we are using the capacity of the networj

very inefficiently. This problem is called silly window

syndrome

• Syndrome Created by the Sender

(66)

Silly Window Syndrome

Nagle’s Algorithm:

• 1. Sending TCP sends the first piece of data it

receives from the sending application program even

if it is 1 byte

• 2. After sending the first segment, the sending TCP

accumulates data in the output buffer and waits until

either the receiving TCP sends an ack or until

enough data has accumulated to fill a max size

segment

(67)

Silly Window Syndrome

Syndrome Created by the Receiver

• Ex: Sender sends 4 k byte of data (receiver

capacity 4kbyte). Receiver appln pgm consumes 1

byte at a time

• Now the receiver application pgm reads the 1 byte

and announces the window size of 1 byte

• Again Inefficiency problem

(68)

Silly Window Syndrome

Delayed Ack:

It is not acknowledged until a decent

amount of space in its incoming buffer

Adv:

Reduces Traffic

(69)

In TCP, the sender window

In TCP, the sender window

size is totally controlled

size is totally controlled

by the receiver window value.

by the receiver window value.

However, the actual window size

However, the actual window size

(70)

Some Points about TCP’s Sliding Windows:

Some Points about TCP’s Sliding Windows:

1. The source does not have to send a

1. The source does not have to send a

full window’s worth of data.

full window’s worth of data.

2. The size of the window can be increased

2. The size of the window can be increased

or decreased by the destination.

or decreased by the destination.

3. The destination can send an

3. The destination can send an

(71)

TCP

OPERATION

12.14

(72)

Figure 12-33

(73)

Figure 12-34

(74)

TCP

(75)
(76)

Figure 12-36

TCBs

Figure

Figure 12.14      Common scenario
Figure 12.20      Sliding window
Figure 12.21      Example 5

References

Related documents

67 move move yer de yer de  ii  tirmek, ta tirmek, ta  ınmak, ta ınmak, ta  ımak, hareket etmek ımak, hareket etmek 68. 68 notice notice fark etmek,

In Table 5- 9, we compare the percentage of captured flow by the follower if the leader locates his/her hubs on the optimal locations of (r|p) hub-centroid or the

Abstract — The purpose of this study is to scrutinize the significance of supply chain strategies - Lean and agile supply chain - as well as the strategic

Installation packages (also known as packages) contain products or product components (known as the package’s payload) and installation information used by the Installer application

This study revealed that the use of high fidelity simulation for interdisciplinary obstetrics skills/drills emergency training significantly (P<0.05) impacted on the

The models were grouped as follows: (1) one-way ANOVAs that examined the effects of job category, age, experience, and gender on both psychological distress and pain regions; (2)

Having documented the existence of price dispersion, in the remainder of this section we out- line which consumer, contract, and market characteristics are associated with higher

While changes in expenditure growth in each city represent the most natural measure of business cycle movements in the Retail Scanner data, I also test the relationship between