SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
Reliable Transport Service
TCP/IP
OSI Model TCP/IP Hierarchy Protocols
7th
Application Layer
6th
Presentation Layer
5th
Session Layer
4th
Transport Layer
3rd
Network Layer
2nd
Link Layer
1st
Physical Layer
Application Layer
Transport Layer
Network Layer
Link Layer
OSI v/s TCP/IP
Transmission Control Protocol
(TCP)
 Major transport service in the TCP/IP suite
 Used for most Internet applications (esp. World Wide Web)
Connection-oriented protocol
Provides a reliable unicast end-to-end byte stream over an unreliable
internetwork.
Very complex
• Specifies format of data and acks
• Specifies how TCP software distinguishes among multiple destinations on a host
• How hosts recover from lost or duplicated packets
• How hosts initiate and terminate a transfer TCP
IP Internetwork
ByteStream
ByteStream
TCP
TCP Characteristics
 Stream orientation
 Virtual circuit connection
 Buffered transfer
 Unstructured stream
 Full duplex connection
 Reliability
Providing Reliability
Traditional technique: Positive Acknowledgement with
Retransmission (PAR)
• Receiver sends acknowledgement when data arrives
• Sender starts timer whenever transmitting
• Sender retransmits if timer expires before
• acknowledgement arrives
Illustration Of Sliding Window
Window size is fixed
As acknowledgement arrives, window moves forward
 Why Sliding Window Works
Because a well-tuned sliding window protocol keeps
the network completely saturated with packets, it obtains
substantially higher throughput than a simple positive
acknowledgement protocol.
Illustration Of Sliding Window
Conceptual Layering Layering Of The Three
Major Protocols
Application
Reliable Stream (TCP) User Datagram (UDP)
Internet (IP)
Network Interface
Ports, Connections, and Endpoints
Like UDP, TCP resides in the transport layer
Like UDP, TCP uses protocol port numbers to identify
the ultimate destination within a host
TCP ports are much more complex than UDP ports
TCP port numbers do not correspond to a single object.
TCP is built on the connection abstraction, in which
objects are identified by connections.
A connection is a pair of endpoints.
An endpoint is a pair, (host, port).
Two connections might share one endpoint.
TCP connection between two endpoints identified by
four items
 Sender’s IP address
 Sender’s protocol port number
 Receiver’s IP address
 Receiver’s protocol port number
An Important Idea About Port Numbers
• Because TCP identifies a connection by a pair of
endpoints, a given TCP port number can be shared by
multiple connections on the same machine.
Passive And Active Opens
Two sides of a connection
 One side waits for contact
• A server program
• Uses TCP’s passive open
One side initiates contact
• A client program
• Uses TCP’s active open
Passive and Active Opens(cntd)
• An application program on one end performs a passive open by
indicating to the OS that it will accept an incoming connection. The OS
provides a TCP port number for its end of the connection.
• An application program on the other end uses an active open request a
connection.
• The two TCP software modules communicate to establish and verify
a connection.
• Once the connection is established, the application programs begin
to pass data.
• TCP modules at each end guarantee reliable delivery.
Segments, Streams, and Sequence Numbers
TCP views the data as a sequence of octets that it divides into segments.
Usually, each segment travels in a single IP datagram.
TCP uses a specialized sliding window mechanism to solve two
problems: efficient transmission and flow control.
TCP allows the receiver to restrict transmission until it has sufficient
buffer space to accommodate more data.
The sliding window mechanism operates the octet level. A sender keeps
three pointers associated with each connection.
TCP software at each end maintains two windows per connection
for a total of four.
 One slides as data is sent, the other as data is
received.
Variable Window Size and Flow Control
TCP allows the window size to vary over time. Each ack contains a
window advertisement that specifies how many octets of data the
receiver is prepared to accept.
This provides flow control. The window size may even be zero.
When intermediate machines become overloaded, the condition is
called congestion, and mechanisms to solve the problem are called
congestion control mechanisms.
Solves two independent problems.
• A hand-held PDA communicating with a fast PC may be overrun.
•A mechanism is needed to allow intermediate systems (routers) to
control a source that sends more traffic than the system can tolerate.
TCP Segment Format
IP header TCP header TCP data
Sequence number (32 bits)
DATA
20 bytes 20 bytes
0 15 16 31
Source Port Number Destination Port Number
Acknowledgement number (32 bits)
window size
header
length
0 Flags
Options (if any)
TCP checksum urgent pointer
20bytes
Port Number:
• A port number identifies the endpoint of a connection.
• A pair <IP address, port number> identifies one
endpoint of a connection.
• Two pairs <client IP address, server port
number> and <server IP address, server port
number> identify a TCP connection.
TCP
IP
Applications
23 10480Ports:
TCP
IP
Applications
7 1680 Ports:
Sequence Number (SeqNo):
• Sequence number is 32 bits long.
• So the range of SeqNo is
0 <= SeqNo <= 232 -1  4.3 Gbyte
• Each sequence number identifies a byte in the byte stream
• Initial Sequence Number (ISN) of a connection is set during
connection establishment
Acknowledgement Number (AckNo):
• Acknowledgements are piggybacked, I.e a segment from A -> B
can contain an acknowledgement for a data sent in the B -> A
direction
18
• A hosts uses the AckNo field to send acknowledgements. (If a host
sends an AckNo in a segment it sets the “ACK flag”)
• The AckNo contains the next SeqNo that a hosts wants to receive
Example: The acknowledgement for a segment with
sequence numbers 0-1500 is AckNo=1501
• TCP uses the sliding window flow protocol (see CS 457) to
regulate the flow of traffic from sender to receiver
• TCP uses the following variation of sliding window:
ono NACKs (Negative ACKnowledgement)
oonly cumulative ACKs
19
Header Length ( 4bits):
• Length of header in 32-bit words
• Note that TCP header has variable length (with minimum 20
bytes)
Flag bits:
• URG: Urgent pointer is valid
oIf the bit is set, the following bytes contain an urgent message in the
range:
oSeqNo <= urgent message <= SeqNo+urgent pointer
• ACK: Acknowledgement Number is valid
• PSH: PUSH Flag
oNotification from sender to the receiver that the receiver should pass all
data that it has to the application.
oNormally set by sender when the sender’s buffer is empty
• RST: Reset the connection
oThe flag causes the receiver to reset the connection
oReceiver of a RST terminates the connection and indicates
higher layer application about the reset
• SYN: Synchronize sequence numbers
oSent in the first packet when initiating a connection
• FIN: Sender is finished with sending
oUsed for closing a connection
oBoth sides of a connection must send a FIN
TCP Checksum:
• TCP checksum covers over both TCP header and TCP data (also
covers some parts of the IP header)
21
• Window Size:
• Each side of the connection advertises the window size
• Window size is the maximum number of bytes that a receiver can
accept.
• Maximum window size is 216-1= 65535 bytes
• Urgent Pointer:
• Only valid if URG flag is set
• Options:
End of
Options kind=0
1 byte
NOP
(no operation) kind=1
1 byte
Maximum
Segment Size
kind=2
1 byte
len=4
1 byte
maximum
segment size
2 bytes
Window Scale
Factor kind=3
1 byte
len=3
1 byte
shift count
1 byte
Timestamp kind=8
1 byte
len=10
1 byte
timestamp value
4 bytes
timestamp echo reply
4 bytes
23
• Options:
• NOP is used to pad TCP header to multiples of 4 bytes
• Maximum Segment Size
• Window Scale Options
oIncreases the TCP window from 16 to 32 bits, I.e., the
window size is interpreted differently
oThis option can only be used in the SYN segment (first
segment) during connection establishment time
• Timestamp Option
oCan be used for roundtrip measurements
Connection Setup
• The client sends a synchronisation (SYN) packet
specifying
• The port number of the server
• The clients initial sequence number
• The server responds with its own SYN segment,
which specifies its initial sequence number (ISN).
The server also acknowledges the clients SYN. This
segment is called a SYN,ACK.
• The client must acknowledge the SYN from the
server by acking the server’s ISN.
• This is called a three way handshake
• Host A performs an Active Open
• Host B performs a Passive Open
• Both sides agree on initial sequence numbers
• Both sides advertise initial window sizes
• Both sides are now ready to transfer data
send
SYN
seq=x
receive SYN
segment
send SYN
seq=y,
ACK x+1
receive
SYN +ACK
segment
send ACK
y+1
receive ACK
segment
host A host B
Connection Closure
• It takes four segments to terminate a
connection
• Each direction of data flow is closed separately.
• It is possible for a TCP connection to be half closed
• Finish segments are issued as a result of an
application close
• ACKs of FIN segments are issued by TCP
without reference to the application
• Host A performs an active close
• Host B performs a passive close
• FIN of A is ACKed immediately by TCP
• Host B only issues its own FIN when the application
has reacted to receipt of the first FIN, by issuing a
send
FIN
seq=x
receive FIN
segment
receive
FIN +ACK
segment
send ACK
y+1
receive ACK
segment
host A host B
receive ACK
segment
send ACK
x+1
send
FIN seq=y,
ACKx+1
TCP State Transitions
• Each TCP connection keeps a record of its state, which allows the
connection to progress through several transitions until closure
• The state transitions facilitate connection set up and termination
• All data transfer takes place within the Established state.
Starting Point
Normal transitions for a server
Active open
recv: FIN
recv: ACK
send: FIN
recv: FIN
Normal transitions for a client
State
SYN_RCVD
LISTEN
ESTABLISHED
SYN_SENT
CLOSE_WAIT
LAST_ACK
FIN_WAIT_1
FIN_WAIT_2 TIME_WAIT
Key
Active Close
Passive Close
CLOSED
send: ACK
appl: passive open
Data transfer state
2MSL timeout
Name of the TCP state
appl: transition undertaken when application issues operation
recv: transition undertaken when segment received
send: what is sent for this transition
Passive Open
CLOSING
Starting Point
Normal transitions for a server
Active open
recv: FIN send:ACK
recv: ACK
Normal transitions for a client
State
SYN_RCVD
LISTEN
ESTABLISHED
SYN_SENT
CLOSE_WAIT
LAST_ACK
FIN_WAIT_1
FIN_WAIT_2 TIME_WAIT
Key
Active Close
Passive Close
CLOSED
Data transfer state
2MSL timeout
Name of the TCP state
appl: transition undertaken when application issues operation
recv: transition undertaken when segment received
send: what is sent for this transition
CLOSING
Starting Point
Normal transitions for a server
Active open
recv: FIN send:ACK
recv: ACK
send: FIN
recv: FIN
recv: ACK
Normal transitions for a client
State
SYN_RCVD
LISTEN
ESTABLISHED
SYN_SENT
CLOSE_WAIT
LAST_ACK
FIN_WAIT_1
FIN_WAIT_2 TIME_WAIT
Key
Active Close
Passive Close
CLOSED
send: ACK
appl: passive open
Data transfer state
2MSL timeout
Name of the TCP state
appl: transition undertaken when application issues operation
recv: transition undertaken when segment received
send: what is sent for this transition
Passive Open
CLOSING
Starting Point
Normal transitions for a server
simultaneous open
send: SYN,ACK
recv: SYN
Active open
simultaneous close
recv: FIN send:ACK
recv: FIN
send: ACK
recv: ACK
send: FIN
recv: FIN
send: FIN
recv: ACK recv: ACK
Normal transitions for a client
State
SYN_RCVD
LISTEN
ESTABLISHED
SYN_SENT
CLOSE_WAIT
LAST_ACK
CLOSINGFIN_WAIT_1
FIN_WAIT_2 TIME_WAIT
Key
Active Close
Passive Close
TCP State Transitions
CLOSED
send: ACK
appl: passive open
appl: close
Data transfer state
2MSL timeout
appl: close
or timeout
Name of the TCP state
appl: transition undertaken when application issues operation
recv: transition undertaken when segment received
send: what is sent for this transition
Passive Open
Reliable TCP Transport Service Explained

Weitere ähnliche Inhalte

Was ist angesagt?

Tcp header/IP Header/Authentication header
Tcp header/IP Header/Authentication headerTcp header/IP Header/Authentication header
Tcp header/IP Header/Authentication headerFaizan Shaikh
 
User datagram protocol (udp)
User datagram protocol (udp)User datagram protocol (udp)
User datagram protocol (udp)Ramola Dhande
 
TCP- Transmission Control Protocol
TCP-  Transmission Control Protocol TCP-  Transmission Control Protocol
TCP- Transmission Control Protocol Akhil .B
 
What Is User Datagram Protocol?
What Is User Datagram Protocol?What Is User Datagram Protocol?
What Is User Datagram Protocol?Simplilearn
 
Communication in Distributed Systems
Communication in Distributed SystemsCommunication in Distributed Systems
Communication in Distributed SystemsDilum Bandara
 
Application Layer Protocols for the IoT
Application Layer Protocols for the IoTApplication Layer Protocols for the IoT
Application Layer Protocols for the IoTDamien Magoni
 
Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)k33a
 
Introduction to TCP/IP
Introduction to TCP/IPIntroduction to TCP/IP
Introduction to TCP/IPMichael Lamont
 
Address resolution protocol
Address resolution protocolAddress resolution protocol
Address resolution protocolasimnawaz54
 

Was ist angesagt? (20)

Tcp header/IP Header/Authentication header
Tcp header/IP Header/Authentication headerTcp header/IP Header/Authentication header
Tcp header/IP Header/Authentication header
 
Tcp IP Model
Tcp IP ModelTcp IP Model
Tcp IP Model
 
User datagram protocol (udp)
User datagram protocol (udp)User datagram protocol (udp)
User datagram protocol (udp)
 
TCP- Transmission Control Protocol
TCP-  Transmission Control Protocol TCP-  Transmission Control Protocol
TCP- Transmission Control Protocol
 
What Is User Datagram Protocol?
What Is User Datagram Protocol?What Is User Datagram Protocol?
What Is User Datagram Protocol?
 
Rarp
RarpRarp
Rarp
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
 
Congestion control
Congestion controlCongestion control
Congestion control
 
CS6551 COMPUTER NETWORKS
CS6551 COMPUTER NETWORKSCS6551 COMPUTER NETWORKS
CS6551 COMPUTER NETWORKS
 
What is Socket?
What is Socket?What is Socket?
What is Socket?
 
Communication in Distributed Systems
Communication in Distributed SystemsCommunication in Distributed Systems
Communication in Distributed Systems
 
Transport Layer
Transport LayerTransport Layer
Transport Layer
 
Application Layer Protocols for the IoT
Application Layer Protocols for the IoTApplication Layer Protocols for the IoT
Application Layer Protocols for the IoT
 
TCP and UDP
TCP and UDP TCP and UDP
TCP and UDP
 
Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)
 
Introduction to TCP/IP
Introduction to TCP/IPIntroduction to TCP/IP
Introduction to TCP/IP
 
C I D R
C I D RC I D R
C I D R
 
Address resolution protocol
Address resolution protocolAddress resolution protocol
Address resolution protocol
 
Tcp presentation
Tcp presentationTcp presentation
Tcp presentation
 
Network Layer
Network LayerNetwork Layer
Network Layer
 

Ähnlich wie Reliable TCP Transport Service Explained

tcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptxtcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptxAlphaKoiSylvester
 
TCP - IP Presentation
TCP - IP PresentationTCP - IP Presentation
TCP - IP PresentationHarish Chand
 
Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................SwatiHans10
 
Eshcol tech solutions pvt ltd
Eshcol tech solutions pvt ltdEshcol tech solutions pvt ltd
Eshcol tech solutions pvt ltdOjas Kumar
 
Unit-4 (1).pptx
Unit-4 (1).pptxUnit-4 (1).pptx
Unit-4 (1).pptxpoonamsngr
 
TCP_NISCHAYBAHL.pptx
TCP_NISCHAYBAHL.pptxTCP_NISCHAYBAHL.pptx
TCP_NISCHAYBAHL.pptxNischayBahl1
 
Transport Control Protocol
Transport Control ProtocolTransport Control Protocol
Transport Control ProtocolBIT DURG
 
13_TCP_Attack.pptx
13_TCP_Attack.pptx13_TCP_Attack.pptx
13_TCP_Attack.pptxAlmaOraevi
 
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9Waqas Ahmed Nawaz
 
Transport protocols
Transport protocolsTransport protocols
Transport protocolsOnline
 
Networking essentials lect3
Networking essentials lect3Networking essentials lect3
Networking essentials lect3Roman Brovko
 
Transport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptxTransport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptxAnkitKumar891632
 
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols
5-LEC- 5.pptxTransport Layer. Transport Layer ProtocolsZahouAmel1
 
Unit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptxUnit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptxDESTROYER39
 
Unit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptxUnit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptxsarosh32
 

Ähnlich wie Reliable TCP Transport Service Explained (20)

tcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptxtcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptx
 
TCP - IP Presentation
TCP - IP PresentationTCP - IP Presentation
TCP - IP Presentation
 
Tcp ip presentation
Tcp ip presentationTcp ip presentation
Tcp ip presentation
 
Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................
 
Eshcol tech solutions pvt ltd
Eshcol tech solutions pvt ltdEshcol tech solutions pvt ltd
Eshcol tech solutions pvt ltd
 
Olumide pidan b
Olumide pidan bOlumide pidan b
Olumide pidan b
 
Unit-4 (1).pptx
Unit-4 (1).pptxUnit-4 (1).pptx
Unit-4 (1).pptx
 
TCP_NISCHAYBAHL.pptx
TCP_NISCHAYBAHL.pptxTCP_NISCHAYBAHL.pptx
TCP_NISCHAYBAHL.pptx
 
Osi model
Osi modelOsi model
Osi model
 
Unit 5.Transport Layer.pptx
Unit 5.Transport Layer.pptxUnit 5.Transport Layer.pptx
Unit 5.Transport Layer.pptx
 
Transport Control Protocol
Transport Control ProtocolTransport Control Protocol
Transport Control Protocol
 
lecturer3.pptx
lecturer3.pptxlecturer3.pptx
lecturer3.pptx
 
13_TCP_Attack.pptx
13_TCP_Attack.pptx13_TCP_Attack.pptx
13_TCP_Attack.pptx
 
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9
CCNA (R & S) Module 01 - Introduction to Networks - Chapter 9
 
Transport protocols
Transport protocolsTransport protocols
Transport protocols
 
Networking essentials lect3
Networking essentials lect3Networking essentials lect3
Networking essentials lect3
 
Transport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptxTransport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptx
 
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
 
Unit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptxUnit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptx
 
Unit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptxUnit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptx
 

Mehr von Anju Kanjirathingal (9)

Java withrealworldtechnology
Java withrealworldtechnologyJava withrealworldtechnology
Java withrealworldtechnology
 
resolution in the propositional calculus
resolution in the propositional calculusresolution in the propositional calculus
resolution in the propositional calculus
 
The propositional calculus
The propositional calculusThe propositional calculus
The propositional calculus
 
microprocessor
microprocessormicroprocessor
microprocessor
 
int 21 h for screen display
int 21 h for screen displayint 21 h for screen display
int 21 h for screen display
 
int 21,16,09 h
int 21,16,09 hint 21,16,09 h
int 21,16,09 h
 
Intel 80286
Intel 80286Intel 80286
Intel 80286
 
OO Design Principles
OO Design PrinciplesOO Design Principles
OO Design Principles
 
2 3 tree
2 3 tree2 3 tree
2 3 tree
 

Kürzlich hochgeladen

ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsManeerUddin
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 

Kürzlich hochgeladen (20)

ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture hons
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 

Reliable TCP Transport Service Explained

  • 2. OSI Model TCP/IP Hierarchy Protocols 7th Application Layer 6th Presentation Layer 5th Session Layer 4th Transport Layer 3rd Network Layer 2nd Link Layer 1st Physical Layer Application Layer Transport Layer Network Layer Link Layer OSI v/s TCP/IP
  • 3. Transmission Control Protocol (TCP)  Major transport service in the TCP/IP suite  Used for most Internet applications (esp. World Wide Web) Connection-oriented protocol Provides a reliable unicast end-to-end byte stream over an unreliable internetwork. Very complex • Specifies format of data and acks • Specifies how TCP software distinguishes among multiple destinations on a host • How hosts recover from lost or duplicated packets • How hosts initiate and terminate a transfer TCP IP Internetwork ByteStream ByteStream TCP
  • 4. TCP Characteristics  Stream orientation  Virtual circuit connection  Buffered transfer  Unstructured stream  Full duplex connection  Reliability
  • 5. Providing Reliability Traditional technique: Positive Acknowledgement with Retransmission (PAR) • Receiver sends acknowledgement when data arrives • Sender starts timer whenever transmitting • Sender retransmits if timer expires before • acknowledgement arrives
  • 6. Illustration Of Sliding Window Window size is fixed As acknowledgement arrives, window moves forward  Why Sliding Window Works Because a well-tuned sliding window protocol keeps the network completely saturated with packets, it obtains substantially higher throughput than a simple positive acknowledgement protocol.
  • 8. Conceptual Layering Layering Of The Three Major Protocols Application Reliable Stream (TCP) User Datagram (UDP) Internet (IP) Network Interface
  • 9. Ports, Connections, and Endpoints Like UDP, TCP resides in the transport layer Like UDP, TCP uses protocol port numbers to identify the ultimate destination within a host TCP ports are much more complex than UDP ports TCP port numbers do not correspond to a single object. TCP is built on the connection abstraction, in which objects are identified by connections. A connection is a pair of endpoints. An endpoint is a pair, (host, port). Two connections might share one endpoint.
  • 10. TCP connection between two endpoints identified by four items  Sender’s IP address  Sender’s protocol port number  Receiver’s IP address  Receiver’s protocol port number An Important Idea About Port Numbers • Because TCP identifies a connection by a pair of endpoints, a given TCP port number can be shared by multiple connections on the same machine.
  • 11. Passive And Active Opens Two sides of a connection  One side waits for contact • A server program • Uses TCP’s passive open One side initiates contact • A client program • Uses TCP’s active open
  • 12. Passive and Active Opens(cntd) • An application program on one end performs a passive open by indicating to the OS that it will accept an incoming connection. The OS provides a TCP port number for its end of the connection. • An application program on the other end uses an active open request a connection. • The two TCP software modules communicate to establish and verify a connection. • Once the connection is established, the application programs begin to pass data. • TCP modules at each end guarantee reliable delivery.
  • 13. Segments, Streams, and Sequence Numbers TCP views the data as a sequence of octets that it divides into segments. Usually, each segment travels in a single IP datagram. TCP uses a specialized sliding window mechanism to solve two problems: efficient transmission and flow control. TCP allows the receiver to restrict transmission until it has sufficient buffer space to accommodate more data. The sliding window mechanism operates the octet level. A sender keeps three pointers associated with each connection. TCP software at each end maintains two windows per connection for a total of four.  One slides as data is sent, the other as data is received.
  • 14. Variable Window Size and Flow Control TCP allows the window size to vary over time. Each ack contains a window advertisement that specifies how many octets of data the receiver is prepared to accept. This provides flow control. The window size may even be zero. When intermediate machines become overloaded, the condition is called congestion, and mechanisms to solve the problem are called congestion control mechanisms. Solves two independent problems. • A hand-held PDA communicating with a fast PC may be overrun. •A mechanism is needed to allow intermediate systems (routers) to control a source that sends more traffic than the system can tolerate.
  • 15. TCP Segment Format IP header TCP header TCP data Sequence number (32 bits) DATA 20 bytes 20 bytes 0 15 16 31 Source Port Number Destination Port Number Acknowledgement number (32 bits) window size header length 0 Flags Options (if any) TCP checksum urgent pointer 20bytes
  • 16. Port Number: • A port number identifies the endpoint of a connection. • A pair <IP address, port number> identifies one endpoint of a connection. • Two pairs <client IP address, server port number> and <server IP address, server port number> identify a TCP connection. TCP IP Applications 23 10480Ports: TCP IP Applications 7 1680 Ports:
  • 17. Sequence Number (SeqNo): • Sequence number is 32 bits long. • So the range of SeqNo is 0 <= SeqNo <= 232 -1  4.3 Gbyte • Each sequence number identifies a byte in the byte stream • Initial Sequence Number (ISN) of a connection is set during connection establishment Acknowledgement Number (AckNo): • Acknowledgements are piggybacked, I.e a segment from A -> B can contain an acknowledgement for a data sent in the B -> A direction
  • 18. 18 • A hosts uses the AckNo field to send acknowledgements. (If a host sends an AckNo in a segment it sets the “ACK flag”) • The AckNo contains the next SeqNo that a hosts wants to receive Example: The acknowledgement for a segment with sequence numbers 0-1500 is AckNo=1501 • TCP uses the sliding window flow protocol (see CS 457) to regulate the flow of traffic from sender to receiver • TCP uses the following variation of sliding window: ono NACKs (Negative ACKnowledgement) oonly cumulative ACKs
  • 19. 19 Header Length ( 4bits): • Length of header in 32-bit words • Note that TCP header has variable length (with minimum 20 bytes) Flag bits: • URG: Urgent pointer is valid oIf the bit is set, the following bytes contain an urgent message in the range: oSeqNo <= urgent message <= SeqNo+urgent pointer • ACK: Acknowledgement Number is valid • PSH: PUSH Flag oNotification from sender to the receiver that the receiver should pass all data that it has to the application. oNormally set by sender when the sender’s buffer is empty
  • 20. • RST: Reset the connection oThe flag causes the receiver to reset the connection oReceiver of a RST terminates the connection and indicates higher layer application about the reset • SYN: Synchronize sequence numbers oSent in the first packet when initiating a connection • FIN: Sender is finished with sending oUsed for closing a connection oBoth sides of a connection must send a FIN TCP Checksum: • TCP checksum covers over both TCP header and TCP data (also covers some parts of the IP header)
  • 21. 21 • Window Size: • Each side of the connection advertises the window size • Window size is the maximum number of bytes that a receiver can accept. • Maximum window size is 216-1= 65535 bytes • Urgent Pointer: • Only valid if URG flag is set
  • 22. • Options: End of Options kind=0 1 byte NOP (no operation) kind=1 1 byte Maximum Segment Size kind=2 1 byte len=4 1 byte maximum segment size 2 bytes Window Scale Factor kind=3 1 byte len=3 1 byte shift count 1 byte Timestamp kind=8 1 byte len=10 1 byte timestamp value 4 bytes timestamp echo reply 4 bytes
  • 23. 23 • Options: • NOP is used to pad TCP header to multiples of 4 bytes • Maximum Segment Size • Window Scale Options oIncreases the TCP window from 16 to 32 bits, I.e., the window size is interpreted differently oThis option can only be used in the SYN segment (first segment) during connection establishment time • Timestamp Option oCan be used for roundtrip measurements
  • 24. Connection Setup • The client sends a synchronisation (SYN) packet specifying • The port number of the server • The clients initial sequence number • The server responds with its own SYN segment, which specifies its initial sequence number (ISN). The server also acknowledges the clients SYN. This segment is called a SYN,ACK. • The client must acknowledge the SYN from the server by acking the server’s ISN. • This is called a three way handshake • Host A performs an Active Open • Host B performs a Passive Open • Both sides agree on initial sequence numbers • Both sides advertise initial window sizes • Both sides are now ready to transfer data send SYN seq=x receive SYN segment send SYN seq=y, ACK x+1 receive SYN +ACK segment send ACK y+1 receive ACK segment host A host B
  • 25. Connection Closure • It takes four segments to terminate a connection • Each direction of data flow is closed separately. • It is possible for a TCP connection to be half closed • Finish segments are issued as a result of an application close • ACKs of FIN segments are issued by TCP without reference to the application • Host A performs an active close • Host B performs a passive close • FIN of A is ACKed immediately by TCP • Host B only issues its own FIN when the application has reacted to receipt of the first FIN, by issuing a send FIN seq=x receive FIN segment receive FIN +ACK segment send ACK y+1 receive ACK segment host A host B receive ACK segment send ACK x+1 send FIN seq=y, ACKx+1
  • 26. TCP State Transitions • Each TCP connection keeps a record of its state, which allows the connection to progress through several transitions until closure • The state transitions facilitate connection set up and termination • All data transfer takes place within the Established state.
  • 27. Starting Point Normal transitions for a server Active open recv: FIN recv: ACK send: FIN recv: FIN Normal transitions for a client State SYN_RCVD LISTEN ESTABLISHED SYN_SENT CLOSE_WAIT LAST_ACK FIN_WAIT_1 FIN_WAIT_2 TIME_WAIT Key Active Close Passive Close CLOSED send: ACK appl: passive open Data transfer state 2MSL timeout Name of the TCP state appl: transition undertaken when application issues operation recv: transition undertaken when segment received send: what is sent for this transition Passive Open CLOSING
  • 28. Starting Point Normal transitions for a server Active open recv: FIN send:ACK recv: ACK Normal transitions for a client State SYN_RCVD LISTEN ESTABLISHED SYN_SENT CLOSE_WAIT LAST_ACK FIN_WAIT_1 FIN_WAIT_2 TIME_WAIT Key Active Close Passive Close CLOSED Data transfer state 2MSL timeout Name of the TCP state appl: transition undertaken when application issues operation recv: transition undertaken when segment received send: what is sent for this transition CLOSING
  • 29. Starting Point Normal transitions for a server Active open recv: FIN send:ACK recv: ACK send: FIN recv: FIN recv: ACK Normal transitions for a client State SYN_RCVD LISTEN ESTABLISHED SYN_SENT CLOSE_WAIT LAST_ACK FIN_WAIT_1 FIN_WAIT_2 TIME_WAIT Key Active Close Passive Close CLOSED send: ACK appl: passive open Data transfer state 2MSL timeout Name of the TCP state appl: transition undertaken when application issues operation recv: transition undertaken when segment received send: what is sent for this transition Passive Open CLOSING
  • 30. Starting Point Normal transitions for a server simultaneous open send: SYN,ACK recv: SYN Active open simultaneous close recv: FIN send:ACK recv: FIN send: ACK recv: ACK send: FIN recv: FIN send: FIN recv: ACK recv: ACK Normal transitions for a client State SYN_RCVD LISTEN ESTABLISHED SYN_SENT CLOSE_WAIT LAST_ACK CLOSINGFIN_WAIT_1 FIN_WAIT_2 TIME_WAIT Key Active Close Passive Close TCP State Transitions CLOSED send: ACK appl: passive open appl: close Data transfer state 2MSL timeout appl: close or timeout Name of the TCP state appl: transition undertaken when application issues operation recv: transition undertaken when segment received send: what is sent for this transition Passive Open