advanced network programming chapter 1
Download
Skip this Video
Download Presentation
Advanced Network Programming Chapter 1

Loading in 2 Seconds...

play fullscreen
1 / 54

Advanced Network Programming Chapter 1 - PowerPoint PPT Presentation


  • 90 Views
  • Uploaded on

Advanced Network Programming Chapter 1. Introduction to Transport Layer and TCP. Networking (OSI) Reference Model. OSI 7-layer Reference Model Application (WEB, NFS, FTP, Telnet, etc.) Presentation (Conversion, Compression, Cryptography) Session (Synchronization)

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Advanced Network Programming Chapter 1' - keegan


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
advanced network programming chapter 1

Advanced Network ProgrammingChapter 1

Introduction

to

Transport Layer and TCP

networking osi reference model
Networking (OSI) Reference Model
  • OSI 7-layer Reference Model
    • Application (WEB, NFS, FTP, Telnet, etc.)
    • Presentation (Conversion, Compression, Cryptography)
    • Session (Synchronization)
    • Transport (End-to-end Messages)
    • Network (Packet Routing)
    • Data Link (Station-to-station Frames)
    • Physical (Bit Transmission)

A. Özgit - Advanced Network Programming

networking
Networking
  • Distinction between service and protocol is important!
    • This will be discussed later.
  • Some widely known transport protocols
    • UDP, TP0, TP4, SNA-APPN, DECnet-NSP, ATM, XTP, T/TCP, RTP, VMTP, NETBLT

A. Özgit - Advanced Network Programming

transport layer layer 4
Transport Layer (Layer-4)
  • Lowest layer that operates on an end-to-end basis.
  • Lies at the boundary between hosts and an internetwork of routers, bridges, and communication links.
  • A good transport layer service
    • Allows applications to use a standard set of primitives.
    • Run on variety of networks – w/o worrying about different network interfaces and reliabilities.
  • Isolates applications from the technology.

A. Özgit - Advanced Network Programming

transport layer layer 41
Transport Layer (Layer-4)
  • Layer-4 provides interprocess communication between two processes that most often are running on different hosts.
  • TCP and its companion UDP (User Datagram Protocol) are the most widely used protocols.
  • Other are from IBM’s SNA, and Digital’s (Compaq) DECnet.
    • Connection to proprietary protocol suites.
  • Ongoing research
    • tcp-impl WG of IETF (www.ietf.org)
    • end2end WG of IRTF (www.irtf.org)

A. Özgit - Advanced Network Programming

transport layer layer 42
Transport Layer (Layer-4)
  • Basic Issues
    • Addressing
    • Connection-oriented (CO) vs. Connectionless (CL)
    • Reliability
      • Loss
      • Duplicate
      • Ordering
      • Integrity
    • Blocking vs. Non-Blocking
    • Multicast, Unicast
    • Priority
    • Security
    • Status Reporting

A. Özgit - Advanced Network Programming

role of tcp
Role of TCP
  • The Web
    • An example of client/server application
  • Web browser (client)
    • Runs on “local” machine
    • Communicates with a server on some “remote” machine
    • Uses an application layer protocol called the HTTP (Hypertext Transfer Protocol).
    • HTTP is a simple request/response protocol.
    • We will use HTTP 0.9 (the simplest) in examples.

A. Özgit - Advanced Network Programming

role of tcp1
Role of TCP
  • Web browser (client)
    • Access TCP’s service thru function calls that comprise that Transport Layer’s Application ++++-Programming Interface (API).
  • API provides
    • (at a minimum) functions to send and receive messages
      • e.g. Berkeley Sockets – read(), write()
    • Connection setup and close for CO protocols
      • e.g. connect(), close()

A. Özgit - Advanced Network Programming

terminology
Terminology
  • Simplified Communication Model (OSI) – Figure-1
    • User Sender / User Receiver at the top
    • Application Entities use the services of the transport layer
    • Peer Entities exchange Protocol Data Units (PDUs)
  • APDU
    • The request “get /index.html”
      • sent from client (application entity) to the server (its peer application entity).
  • Bi-directional Protocol
    • Both sides can send and receive data simultaneously.

A. Özgit - Advanced Network Programming

terminology1
Terminology
  • Transport Entity
    • Hardware and/or software within a given host that implements a particular transport service and protocol.
  • User Sender
    • submits a chunk of user data (Transport Service Data Unit – TSDU; informally a message) to the transport sender.
  • Transport Sender
    • transmits or sends this data to the transport receiver over a network which may provide different levels of reliability.

A. Özgit - Advanced Network Programming

terminology2
Terminology
  • Transport Receiver
    • receives the data that arrives from the network and delivers it to the user receiver.
  • TPDUs may flow in both directions even when user data flows only from sender to receiver
    • Control TPDUs
      • Separate and/or Piggybacked

A. Özgit - Advanced Network Programming

terminology3
Terminology
  • What happens to the request APDU?
    • APDU becoming a single TSDU, being encapsulated in a single TPDU, which in turn becomes a single NSDU, which is encapsulated in a single NPDU (Figure-2)
  • TCP’s TPDU  TCP segment
    • Packet  IP datagram (NPDU) or TCP segment (informally)
  • IP’s PDU  Datagram
    • Datagram  IP’s NPDU or UDP’s TPDU (informally)

A. Özgit - Advanced Network Programming

example tcp connection 1
Example TCP Connection (1)
  • Enter “http://ozgit.nom.tr/index.html” from web client.
    • http indicates application layer protocol to be used.
    • TCP port number 80 (implicitly) to be used.
    • “ozgit.nom.tr” is the host name (mapped to an IP number –144.122.71.91- by DNS)
    • Transport Service Access Point (TSAP)
      • TSAP  IP Address + TCP Port Number
      • One end point of a communication channel between a process on a local m/c and a process on a remote m/c.
    • “index.html” is the file being requested.
      • http request (APDU)  “GET /index.html”

A. Özgit - Advanced Network Programming

example tcp connection 2
Example TCP Connection (2)
  • Connection request to the transport entity at (144.122.71.91, 80).
    • By calling connect()
    • Local TCP initiates a 3-way handshake with the remote server.
    • TPDUs are exchanged between TCP entities to ensure reliable connection establishment and toestablish initial sequence numbers.
    • If 3-way handshake fails, TCP notifies the application.
    • Otherwise success code is returned -confirmation.
  • OSI Model:
    • Request – Indication
    • Response - Confirmation

A. Özgit - Advanced Network Programming

example tcp connection 3
Example TCP Connection (3)
  • Web client submits a request to send data (APDU – “GET /index.html”)
  • Local TCP sends this data most likely in a single TPDU.
    • TCP Segment  TSDU + Transport Layer Header

A. Özgit - Advanced Network Programming

example tcp connection 4
Example TCP Connection (4)
  • Remote TCP receives the TPDU, the data (APDU – “GET /index.html”) is buffered.
    • Delivered when Web server does a read()
    • This delivery is known as a data indication in OSI terminology.
  • Remote TCP also sends back an acknowledgement (ACK) -control TPDU- to the local TCP

A. Özgit - Advanced Network Programming

example tcp connection 5
Example TCP Connection (5)
  • The Web server responds with contents of “index.html”.
    • File may be too large to be efficiently submitted to TCP in one write() call –i.e., one TSDU.
      • Web Server divides APDU into multiple write() calls –i.e., multiple TSDUs.
      • Remote TCP then sends these TSDUs to local the TCP in multiple TPDUs.
  • TCP treats the data as a byte stream and segments it as necessary –i.e., does not care about TSDU boundaries.
    • Boundaries between APDUs, submitted TSDUs, TPDUs, and delivered TSDUs may all be different.

A. Özgit - Advanced Network Programming

example tcp connection 6
Example TCP Connection (6)
  • TCP must detect and recover from network errors.
    • As the remote TCP send the TPDUs, it includes a sequence number in each TPDU.
    • It also copies each TPDU into a buffer, and sets a timer.
      • Retransmits the TPDU if timer expires before getting an ACK.
    • Retransmission is done in a new TPDU.
    • Individual byte-stream sequence numbers are used.
      • TPDUs retransmitted may or may not correspond exactly to the original TPDUs.
    • Remote TCP also places a checksum is the TPDU header to detect bit errors.

A. Özgit - Advanced Network Programming

example tcp connection 7
Example TCP Connection (7)
  • As TPDUs are received by the local TCP
    • TPDUs with checksum errors are discarded.
    • It ensures that no pieces of the byte-stream are missing
    • Out-of-order arrivals are reordered.
    • It responds to the remote TCP with ACK TPDUs.
    • Duplicates are discarded (e.g., as a consequence of lost ACK TPDUs).
  • Pieces of byte-stream are buffered in local TCP
    • Web client requests them by doing read() calls.
    • Each read() results in delivery of a TSDU.

A. Özgit - Advanced Network Programming

example tcp connection 8
Example TCP Connection (8)
  • TCP connection is bi-directional.
    • Either side may initiate the closing of the connection
    • In first generation web systems the server initiates the close by calling close() function (Disconnect Request).
      • Disconnect is handled with a 4-way handshake procedure.

A. Özgit - Advanced Network Programming

transport service
Transport Service
  • A transport service abstracts a set of functions that is provided to a higher layer.
  • A protocol, refers to the details of how a transport sender and a transport receiver cooperate to provide that service.
  • Distinction between service and protocol is important (Contribution of OSI Reference Model).

A. Özgit - Advanced Network Programming

co message vs co byte vs cl
CO-message vs. CO-byte vs. CL
  • Two types of transport services
    • Connection-oriented (CO)
      • Provides for the establishment, maintenance, and termination of a logical connection between transport users (three distinct phases of operation).
        • Connection Establishment (T-Connect)
        • Data Transfer (T-Data)
        • Connection Termination (T-Disconnect)
      • CO service has two variations
        • Message-oriented (TP4)
        • Byte-stream
    • Connectionless (CL)
      • Provides only one phase of operation: data transfer.

A. Özgit - Advanced Network Programming

reliability
Reliability
  • A service is reliable if and only if it satisfies all of the following:
    • No-loss
    • No-duplicates
    • Ordered
    • Data Integrity

A. Özgit - Advanced Network Programming

no loss vs uncontrolled loss vs controlled loss
No-loss vs. Uncontrolled-loss vs. Controlled-loss
  • No-loss (at-least-once delivery) service guarantees either of the two results:
    • The data is delivered to the user receiver, or
    • The user sender is notified that some data may not have been delivered.
  • Uncontrolled-loss (best-effort)
    • No assurance
    • Example: UDP
  • Controlled-loss
    • Loss may occur, but there is control over the degree of loss.
    • Example: k-XP

A. Özgit - Advanced Network Programming

no duplicates vs maybe duplicates
No-duplicates vs. Maybe-duplicates
  • No-duplicates
    • At-most-once delivery
    • e.g., TCP
  • Maybe-duplicates
    • Efforts by the protocol may or may not be made to avoid delivering duplicates.
    • e.g., UDP

A. Özgit - Advanced Network Programming

ordered vs unordered vs partially ordered
Ordered vs. Unordered vs. Partially-ordered
  • Ordered service
    • Preserves user sender’s submission order of data.
    • e.g., TCP
  • Unordered service
    • Does not provide the above guarantee.
    • e.g., UDP
  • Partially-ordered service
    • Guarantees to deliver pieces of data in one of a set of permitted orders as predefined by a partial order relation agreed upon by the user sender and user receiver.
    • e.g., Multimedia comm., distributed databases.

A. Özgit - Advanced Network Programming

data integrity vs no data integrity vs partial data integrity
Data-integrity vs. No-data-integrity vs. Partial-data-integrity
  • Data-integrity
    • Ensures with high probability that all data bits delivered to a user receiver are identical to those originally submitted.
      • Strength of the error detection method.
      • TCP uses 16-bit checksum.
  • No-data-integrity
    • Provide no guarantees regarding bit errors.
  • Partial-data-integrity
    • A controlled amount of bit errors (as a means of achieving higher throughput).
      • e.g., real-time multimedia application

A. Özgit - Advanced Network Programming

remarks on reliability and co vs cl
Remarks on Reliability and CO vs. CL
  • All aspects of reliability (loss, duplicates, order, data-integrity) are orthogonal.
    • Data might get lost while the order is preserved.
  • Relationship between a service being CO or CL and whether or not it is reliable.
    • These two services are orthogonal.
    • CO service is assumed to be reliable. Why?

A. Özgit - Advanced Network Programming

remarks on reliability and co vs cl1
Remarks on Reliability and CO vs. CL
  • Whereas: TCP service is CO and TCP service is reliable,
  • Whereas: TP4 service is CO and TP4 service is reliable,
  • Whereas: X.25 service is CO and X.25 service is reliable
  • CO service  Reliable Service ?

A. Özgit - Advanced Network Programming

remarks on reliability and co vs cl2
Remarks on Reliability and CO vs. CL
  • Whereas: UDP service is CL and UDP service is unreliable,
  • CL service  Unreliable Service ?

A. Özgit - Advanced Network Programming

blocking vs non blocking
Blocking vs. Non-blocking
  • Blocking service
    • Ensures that the transport layer is not overwhelmed with incoming data.
    • Provides flow control between user sender and transport sender.
  • Non-blocking service
    • Allows the user sender to submit data and continue processing w/o awaiting the transport sender’s OK.

A. Özgit - Advanced Network Programming

multicast vs unicast
Multicast vs. Unicast
  • Multicast service
    • Enables a user sender to submit data, a copy of which will be delivered to one or more user receiver(s).
  • Unicast service
    • Delivery of data to exactly one user receiver.

A. Özgit - Advanced Network Programming

priority vs no priority
Priority vs. No-priority
  • Priority service
    • Enables a user sender to indicate the relative importance of various messages.
    • May be combined with uncontrolled-loss or controlled-loss service to drop lower priority data, thereby allowing the delivery of high-priority data with smaller delay and/or higher probability.
  • No-priority service
    • No differentiation of the importance of the classes of data.

A. Özgit - Advanced Network Programming

security vs no security
Security vs. No-security
  • Security service
    • A security service provides one or more security functions such as authentication, access control, confidentiality, and integrity [ISO-7498-2].
      • Authentication is the verification of user sender’s and user receiver’s identity.
      • Access control checks a user’s permission status, allowing the use of different resources.
      • Confidentiality guarantees that only the intended user receiver(s) can decode and understand the user sender’s data.
      • Integrity detects any modification, insertion, deletion, or replay of transport sender’s data.
    • e.g., TP4
  • No-security service
    • Does not provide any of the above security functions.

A. Özgit - Advanced Network Programming

status reporting vs non status reporting
Status-reporting vs. Non-status-reporting
  • Status-reporting service
    • Allows a user sender to obtain specific information about the transport entity or its connections.
  • Non-status reporting service
    • Does not provide any information about the transport entity and its connections.

A. Özgit - Advanced Network Programming

q o s vs no q o s
QoS vs. No-QoS
  • QoS service
    • Allows a user sender to specify the quality of transmission service desired.
  • No-QoS service
    • Delivery of data to exactly one user receiver.

A. Özgit - Advanced Network Programming

q o s parameters iso
QoS Parameters (ISO)
  • Connection Establishment Delay
  • Connection Establishment Failure Probability
  • Throughput
  • Transit Delay
  • Residual Error Rate
  • Transfer Failure Probability
  • Connection Release Delay
  • Connection Release Failure Probability

A. Özgit - Advanced Network Programming

q o s parameters iso1
QoS Parameters (ISO)
  • Protection
  • Priority
  • Resilience
  • The ATM environment supports only two QoS parameters:
    • (sustained) target, acceptable, and minimum throughput
    • Transit delay

A. Özgit - Advanced Network Programming

transport protocol features
Transport Protocol Features
  • CO vs. CL
    • Establishment and maintenance of state information
      • A record of characteristics and events related to the communication between the transport sender and receiver.
    • CO: state information is maintained
    • Three phases:
      • Connection Establishment
      • Data Transfer
      • Connection Termination
    • CL: no state information is maintained

A. Özgit - Advanced Network Programming

transport protocol features1
Transport Protocol Features
  • Transaction Oriented
    • A single APDU (request) is sent by user sender
    • User receiver responds with a single APDU (response)
    • Characteristics:
      • Asymmetrical model
      • Simplex data transfer
      • Short duration
      • Low delay
      • Few data TPDUs
      • Message orientation
      • Need for a no-duplicate service

A. Özgit - Advanced Network Programming

transport protocol features2
Transport Protocol Features
  • CO Protocol Features
    • Signaling – exchange of control (state) information
      • In-band (more suitable for short-lived connections)
      • Out-of-band (desirable for high-speed communication systems)
    • Unidirectional vs. Bidirectional

A. Özgit - Advanced Network Programming

transport protocol features3
Transport Protocol Features
  • Connection Establishment (See Figure-3)
    • Implicit connect
      • Connection is established as soon as the first TPDU is sent or received.
    • 2-way-handshake connect
      • CR-TPDU (Connection Request)
      • CC-TPDU (Connection Confirm)
    • 3-way-handshake connect
      • CR-TPDU (Connection Request)
      • CC-TPDU (Connection Confirm)
      • ACK-CC-TPDU (ACK for Connection Confirm)

A. Özgit - Advanced Network Programming

transport protocol features4
Transport Protocol Features
  • Connection Termination (See Figure-4)
    • Implicit disconnect
      • Time-out
    • Abortive disconnect
      • Close connection abnormally due to an error condition
    • 2-way-handshake disconnect
      • DR-TPDU (Disconnect Request)
      • DC-TPDU (Disconnect Confirm)
    • 4(3)-way-handshake disconnect
      • Two 2-way-handshakes one for each direction of data flow
      • 3-way if the first DC-TPDU also functions as a DR-TPDU for the reverse direction

A. Özgit - Advanced Network Programming

error control
Error Control
  • Guard against loss or damage of user data and control information
  • For realistic high-speed networks with low error rates, transport layer error control is more efficient than link layer error control.
  • Two phases:
    • Error detection
    • Error reporting and recovery

A. Özgit - Advanced Network Programming

error control1
Error Control
  • Error Detection
    • Identifies lost, misordered, duplicated and corrupted TPDUs
    • Sequence numbers handles the first three problems
    • Corrupted data is discovered by means of:
      • Length fields
      • Error Detecting Codes (EDC)
        • The header/trailer, the data, or the both
        • Separate EDCs are recommended for multimedia applications

A. Özgit - Advanced Network Programming

error control2
Error Control
  • Error Reporting and Recovery
    • Error reporting is a mechanism where receiver explicitly informs the sender about errors that have been detected.
    • Error recovery is a mechanism used by both sender and receiver to recover from errors whether or not they are explicitly reported.
    • Timers, sequence numbers and acknowledgements are used.

A. Özgit - Advanced Network Programming

error control3
Error Control
  • Error Reporting and Recovery
    • A positive ACK (PACK)
    • PAR (Positive ACK with Retransmission) or ARQ (Automatic Repeat Request)
      • Upon receipt of an ACK, the sender updates its state information, discards buffered TPDUs that are acknowledged, and retransmits any TPDUs that are not acknowledged.
      • In case of timeout, it may assume something has gone wrong and retransmits unacknowledged TPDU(s).
    • No error reporting mechanism

A. Özgit - Advanced Network Programming

error control4
Error Control
  • Error Reporting and Recovery
    • A negative ACK (NACK) aka Selective Reject
      • Explicitly identifies TPDUs that have not been received

A. Özgit - Advanced Network Programming

error control5
Error Control
  • Piggybacking
    • Artificially delay returning an ACK hoping the receiver will soon submit its next message to be sent as a part of the reverse direction data flow.
    • When this occurs, the ACK is piggyback-ed as header information on the reverse direction data TPDU.

A. Özgit - Advanced Network Programming

error control6
Error Control
  • Cumulative vs. Selective Acknowledgement
    • Cumulative PACK
      • Carries a sequence number indicating that all TPDUs with lower sequence numbers have been received.
      • A recent cumulative PACK incorporates the information of the previously lost one.
      • Unnecessary retransmissions of correctly received TPDUs.
    • Selective PACK
      • Acknowledges exactly one TPDU
    • Block PACK
      • Variation of selective PACK where blocks of individual TPDUs are selectively acknowledged.

A. Özgit - Advanced Network Programming

error control7
Error Control
  • Retransmission Strategies
    • When the sender does not receive a PACK within a pre-determined timeout period, or when it receives back-to-back cumulative PACKs that are identical.
    • Selective Repeat (Conservative)
      • Sender retransmits selectively only TPDUi and wait for a PACK with sequence number larger than previous PACKs.
    • Go-Back-N (More Aggressive)
      • Sender retransmits TPDUi and all TPDUs already sent after TPDUi
      • Decrease channel utilization by potentially retransmitting correctly-received TPDUs.

A. Özgit - Advanced Network Programming

flow control
Flow Control

A. Özgit - Advanced Network Programming

multiplexing demultiplexing
Multiplexing/Demultiplexing
  • See Figure 5(a)
  • Several transport layer connections using a single network layer association.
  • Efficient use of network layer resources.

A. Özgit - Advanced Network Programming

tcp transmission control protocol
TCP (Transmission Control Protocol)
  • Connection-oriented (CO)

A. Özgit - Advanced Network Programming

ad