UCTI SPACC 04 Process to Process Delivery UDP and TCP

Embed Size (px)

Citation preview

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    1/77

    System Programming and Computer Control

    Client-Server Model: Socket Interface

    Slide 1Process to process delivery UDP and TCP

    Process to Process Delivery:UDP and TCP

    Prepared by: KL First Prepared on: 9-09-07 Last Modified on:

    Quality checked by: xxx

    Copyright 2007 Asia Pacific Institute of Information Technology

    Level-2

    System Programming and Computer ControlCE00352-2-SPCC

    http://www.apiit.edu.my/http://www.apiit.edu.my/http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    2/77

    System Programming and Computer Control Slide 2Process to process delivery UDP and TCP

    Topic & Structure of the lesson

    Process to Process Delivery

    User Datagram Protocol (UDP)

    Transmission Control Protocol (TCP)

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    3/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    4/77

    System Programming and Computer Control Slide 4Process to process delivery UDP and TCP

    Key Terms you must be able to use

    Client

    Client-server paradigm

    Connection establishment

    Connection termination

    Connectionless service

    Connection-oriented service

    Ephemeral port number

    Finite state machine

    Flow control

    Keep-alive timer

    Persistence timer

    Port number

    Process-to-process delivery

    Receiver window Retransmission timer

    Round-trip time (RTT)

    Segment

    Sender window Sequence number

    Server

    Silly windows syndrome

    If you have mastered this topic, you should be able to use the following terms

    correctly in your assignments and exams:-

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    5/77

    System Programming and Computer Control Slide 5Process to process delivery UDP and TCP

    Key Terms you must be able to use

    Sliding window

    Socket address

    State transition diagram

    TCP timer

    Three-way handshake

    Time-waited timer

    Transmission ControlProtocol (TCP)

    User datagram User Datagram Protocol

    (UDP)

    Well-known port numbers

    If you have mastered this topic, you should be able to use the following terms

    correctly in your assignments and exams:-

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    6/77

    System Programming and Computer Control Slide 6Process to process delivery UDP and TCP

    Position of transport layer

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    7/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    8/77System Programming and Computer Control Slide 8Process to process delivery UDP and TCP

    Transport layer duties

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    9/77System Programming and Computer Control Slide 9Process to process delivery UDP and TCP

    Packetizing

    The transport layer creates packetsout of the

    message received from the application layer.

    Packetizing divides a long messageinto smallerones and encapsulated into the data field of the

    transport-layer packet and headers are added.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    10/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    11/77System Programming and Computer Control Slide 11Process to process delivery UDP and TCP

    Addressing

    The packet carrying the request must specify to

    which server program the request must be

    delivered.

    The request packet must also specify the client

    program that sent the packet.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    12/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    13/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    14/77System Programming and Computer Control Slide 14Process to process delivery UDP and TCP

    The transport layer is responsible for

    process-to-process delivery.

    Note:

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    15/77System Programming and Computer Control Slide 15Process to process delivery UDP and TCP

    Types of data deliveries

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    16/77System Programming and Computer Control Slide 16Process to process delivery UDP and TCP

    Process-to-Process Delivery

    1. Client-Server Paradigm

    2. Addressing

    3. Multiplexing and Demultiplexing

    4. Connectionless/Connection-Oriented5. Reliable/Unreliable

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    17/77System Programming and Computer Control Slide 17Process to process delivery UDP and TCP

    Client-server Paradigm

    A process on the local host, called a client, needsservices from a process usually on the remote host,called a server.

    Operating system today support both multiuser andmultiprogramming environments. A remote computercan run several server programs at the same time, justas local computers can run one or more clientprograms at the same time.

    Local host

    Local process

    Remote host

    Remote process

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    18/77System Programming and Computer Control Slide 18Process to process delivery UDP and TCP

    Addressing

    A transport-layer address, called a port number,

    to choose among multiple processes running on

    the destination host.

    The destination port number is needed for

    delivery; the source port number is needed for

    the reply.

    Ephemeral portnumber are 16-bit integers

    between 0 and 65,535.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    19/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    20/77System Programming and Computer Control Slide 20Process to process delivery UDP and TCP

    Addressing

    The Internet has decided to use universal portnumbers for servers; these are called well-known port numbers.

    The IP addressesand port numbersplaydifferent roles in selecting the final destinationof data.

    The destination IP address defines the hostamong the different hosts in the world. After thehost been selected, the port numberdefines

    one of the processes on this particular host.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    21/77System Programming and Computer Control Slide 21Process to process delivery UDP and TCP

    IP addresses versus port numbers

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    22/77System Programming and Computer Control Slide 22Process to process delivery UDP and TCP

    Address IANA Ranges

    The IANA (Internet Assigned Number Authority)has divided the port numbers into three ranges:

    Well-known ports. The port ranging from 0 to 1023

    are assigned and controlled by IANA.

    Registered ports. The ports ranging 1024 to 49,151are not assigned or controlled by IANA. They canonly be registered with IANA to prevent duplication.

    Dynamic ports. The ports ranging from 49,152 to65,535 are neither controlled nor registered. Theycan be used by any process.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    23/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    24/77System Programming and Computer Control Slide 24Process to process delivery UDP and TCP

    Socket address

    The combination of an IPaddress and a port numberis called a socketaddress.

    A transport-layer protocolneeds a pair of socket addresses: the clientsocket address and the server socket address.

    The UDP and TCP header contains the port numbers.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    25/77

    System Programming and Computer Control Slide 25Process to process delivery UDP and TCP

    Multiplexing and demultiplexing

    The addressing mechanism allows multiplexing and

    demultiplexingby the transport layer.

    Multiplexing: At the sender site, there may be several

    processes that need to send packets. The protocolaccepts message from different processes. After

    adding the header, the transport layer passes the

    packet to the network layer.

    Demultiplexing: At the receiver site, the transport layer

    delivers each message to the appropriate process

    based on the port number.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    26/77

    System Programming and Computer Control Slide 26Process to process delivery UDP and TCP

    Multiplexing and demultiplexing

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    27/77

    System Programming and Computer Control Slide 27Process to process delivery UDP and TCP

    Connectionless vs Connection-Oriented

    A transport-layer protocol can either be connectionless

    or connection-oriented.

    Connectionless Service

    The packets are sent from one party to another with

    no need for connection establishment or connection

    release.

    The packets are not numbered; they may be delayed,

    or arrive out of sequence.

    There is no acknowledgment either. Example UDP.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    28/77

    System Programming and Computer Control Slide 28Process to process delivery UDP and TCP

    Connection Oriented Service

    A connection is first established between the sender and thereceiver. Data are transferred. At the end, the connection isreleased. Example: TCPis a connection-oriented protocol.

    Connection Establishment

    1. Host A sends a packet to announce its wish for connection and includesits initialization information about traffic from A to B.

    2. Host B send a packet to acknowledge (confirm) the request of A.

    3. Host B sends a packet that includes its initialization information about

    traffic from B to A.4. Host A sends a packet to acknowledge (confirm) the request of B.

    This connection establishment implies four steps. However,since steps 2 and 3 can occur at the same time, they can be

    combined into one step.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    29/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    30/77

    System Programming and Computer Control Slide 30Process to process delivery UDP and TCP

    Connection Termination

    Connection in one direction is terminated, the other party cancontinue sending data in the other direction. Therefore, fouractions needed to close the connections in both directions:

    1. Host A sends a packet announcing its wish for connection termination.

    2. Host B sends a segment acknowledging (confirming) the request of A.After this, the connection is closed in one direction, but not in the other.Host B can continue sending data to A.

    3. When host B has finished sending its own data, it sends a segment toindicate that it wants to close the connection.

    4. Host A acknowledges (confirms) the request of B.

    The four-step connection termination cannot be reduced tothree steps because the two parties may not wish to terminateat the same time. In other words, connection termination is

    asymmetric.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    31/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    32/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    33/77

    System Programming and Computer Control Slide 33Process to process delivery UDP and TCP

    Error control

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    34/77

    System Programming and Computer Control Slide 34Process to process delivery UDP and TCP

    User Datagram Protocol (UDP)

    1. Port Numbers

    2. User Datagram

    3. Applications

    UDP does not add anything to the services of IP except for providing process-to-process communication instead of host-to-host communication. Also, it performsvery limited error checking.

    UDP is very simple protocol with a minimum of overhead.

    UDP is a convenient protocol for multimedia and multicasting applications.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    35/77

    System Programming and Computer Control Slide 35Process to process delivery UDP and TCP

    UDP is a connectionless, unreliable

    protocol that has no flow and error

    control. I t uses port numbers tomultiplex data from the application

    layer.

    Note:

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    36/77

    System Programming and Computer Control Slide 36Process to process delivery UDP and TCP

    Well-known ports used by UDP

    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 day19 Chargen Returns a string of characters

    53 Nameserver Domain Name Service

    67 Bootps Server port to download bootstrap information

    68 Bootpc Client port to download bootstrap information

    69 TFTP Trivial File Transfer Protocol

    111 RPC Remote Procedure Call

    123 NTP Network Time Protocol

    161 SNMP Simple Network Management Protocol

    162 SNMP Simple Network Management Protocol (trap)

    http://www.apiit.edu.my/http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    37/77

    System Programming and Computer Control Slide 37Process to process delivery UDP and TCP

    User Datagram Format

    Source port number. This is the port number used by theprocess running on the source host.

    Destination port number. This is the port number used by theprocess running on the destination host.

    Length. This is a 16-bit field that defines the total length of theuser datagram, header plus data.

    Checksum. This field is used to detect errors over the entireuser datagram (header plus data). This ensures that those

    fields have not been changed from the source to thedestination. The calculation of the checksum and its inclusion ina user datagram are option. If the checksum is not calculated,the field is filled with 0s.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    38/77

    System Programming and Computer Control Slide 38Process to process delivery UDP and TCP

    User datagram format

    UDP Packets, called user datagrams, have a fixed-size header of 8 bytes.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    39/77

    System Programming and Computer Control Slide 39Process to process delivery UDP and TCP

    The calculation of checksum and its

    inclusion in the user datagram areoptional.

    Note:

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    40/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    41/77

    System Programming and Computer Control Slide 41Process to process delivery UDP and TCP

    UDP is a convenient transport-layer

    protocol for applications that provide

    f low and error control. I t is also usedby multimedia applications.

    Note:

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    42/77

    System Programming and Computer Control Slide 42Process to process delivery UDP and TCP

    Transmission Control Protocol (TCP)

    Port Numbers

    ServicesSequence Numbers

    Segments

    Connection

    Transition Diagram

    Flow and Error Control

    Silly Window Syndrome

    TCP is called a stream connection-orientedand reliable transport protocol.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    43/77

    System Programming and Computer Control Slide 43Process to process delivery UDP and TCP

    Port Numbers

    Like UDP, TCP uses port numbers as tranport-

    layer addresses.

    If an application can use both UDP and TCP,the same port number is assigned to this

    application.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    44/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    45/77

    System Programming and Computer Control Slide 45Process to process delivery UDP and TCP

    Stream delivery

    TCP, is steam-oriented protocol. In UDP, a process(an application program) sends a chunk of bytes toUDP for delivery. UDP adds its own header to thischunk of data, which is now called a user datagram,

    and delivers it to IP for transmission. The process maydeliver several chunks of data to the UDP, but UDPtreats each chunk independently without seeing anyconnection between them.

    TCP, on the other hand, allows the sending process todeliver data as a stream of bytes and the receivingprocess to obtain data as a stream of bytes. TCPcreates an environment in which the two processesseem to be connected by an imaginary. tube that

    carries their data across the Internet.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    46/77

    System Programming and Computer Control Slide 46Process to process delivery UDP and TCP

    Stream delivery

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    47/77

    System Programming and Computer Control Slide 47Process to process delivery UDP and TCP

    Sending and receiving buffers

    The sending and the receiving processes may

    not produce and consume data at the same

    speed. TCP needs buffers for storage.

    There are two buffers, the sending buffer and

    the receiving buffer, for each direction.

    One way to implement a buffer is to use acircular array of 1-byte locations.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    48/77

    System Programming and Computer Control Slide 48Process to process delivery UDP and TCP

    Sending and receiving buffers

    At the sending site, the buffer has three types of locations. The white section containsempty locations that can be filled by the sending process.

    The blue area hold bytes that have been sent but not yet acknowledged.

    The bytes in blue locations area acknowledged, the location is recycled and availablefor use by the sending process.

    After both processes have no data left to send and the buffers are empty, the two

    TCPs destroy their buffers.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    49/77

    System Programming and Computer Control Slide 49Process to process delivery UDP and TCP

    TCP segments

    TCP groups a number of bytes together into a packetcalled a segment.

    TCP adds a header to each segment and delivers the

    segment to the IP layer for transmission.

    The segments are encapsulated in an IP datagram

    and transmitted.

    The segments are not necessarily the same size. Inreality segments carry hundreds, if not thousands, of

    bytes.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    50/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    51/77

    System Programming and Computer Control Slide 51Process to process delivery UDP and TCP

    Byte Numbers

    TCP numbers all data bytes that are transmitted

    in a connection. Numbering is independent in

    each direction.

    When TCP receives bytes of data from the

    process and stores them in the sending buffer,

    it numbers them.

    The numbering does not necessary start from

    0; it starts with a randomly generated number

    between 0 and 2321.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    52/77

    System Programming and Computer Control Slide 52Process to process delivery UDP and TCP

    The bytes of data being transferred in

    each connection are numbered by

    TCP. The numbering starts with a

    randomly generated number.

    Note:

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    53/77

    System Programming and Computer Control Slide 53Process to process delivery UDP and TCP

    Example 1

    Imagine a TCP connection is transferring a file of 6000 bytes. The

    first byte is numbered 10010. What are the sequence numbers for

    each segment if data are sent in five segments with the first foursegments carrying 1000 bytes and the last segment carrying 2000

    bytes?

    Solution

    The following shows the sequence number for each segment:Segment 1==> sequence number: 10,010 (range: 10,010 to 11,009)Segment 2 ==> sequence number: 11,010 (range: 11,010 to 12,009)Segment 3==> sequence number: 12,010 (range: 12,010 to 13,009)Segment 4 ==> sequence number: 13,010 (range: 13,010 to 14,009)

    Segment 5 ==> sequence number: 14,010 (range: 14,010 to 16,009)

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    54/77

    System Programming and Computer Control Slide 54Process to process delivery UDP and TCP

    The value of the sequence number

    f ield in a segment defines the number

    of the first data byte contained in thatsegment.

    Note:

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    55/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    56/77

    System Programming and Computer Control Slide 56Process to process delivery UDP and TCP

    TCP segment format

    The unit of data transfer between two devicesusing TCP is a segment.

    The segment consist of a 20- to 60-byte

    header, followed by data from the application

    program.

    The header is 20 bytes if there are no optionsand up to 60 bytes if it contains options.

    C f

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    57/77

    System Programming and Computer Control Slide 57Process to process delivery UDP and TCP

    TCP segment format

    Next slide discuss the above header fields

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    58/77

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    59/77

    System Programming and Computer Control Slide 59Process to process delivery UDP and TCP

    Header

    Acknowledgment number: This 32-bit field defines the bytenumber that the sender of the segment is expecting to receivefrom the other party. If the byte numbered x has beensuccessful received, x+1 is the acknowledgment number.

    Header length: This 4-bit field indicates the number of 4-bytewords in the TCP header. The length of the header can bebetween 20 and 60 bytes. Therefore, the value of this field canbe between 5 (5x4 = 20) and 15 (15x4 =60).

    Reserved: This field defines 6 different control bits or flagswhich can be set at a time. These bits enable flow control,connection establishment and termination, and the mode ofdata transfer in TCP.

    C t l fi ld

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    60/77

    System Programming and Computer Control Slide 60Process to process delivery UDP and TCP

    Control field

    Description of flags in the control field

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    61/77

    System Programming and Computer Control Slide 61Process to process delivery UDP and TCP

    Description of flags in the control field

    Flag Description

    URG The value of the urgent pointer field is valid.

    ACK The value of the acknowledgment field is valid.

    PSH Push the data.

    RST The connection must be reset.

    SYN Synchronize sequence numbers during connection.

    FIN Terminate the connection.

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    62/77

    System Programming and Computer Control Slide 62Process to process delivery UDP and TCP

    Three-step connection establishment

    F t ti t i ti

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    63/77

    System Programming and Computer Control Slide 63Process to process delivery UDP and TCP

    Four-step connection termination

    St t f TCP

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    64/77

    System Programming and Computer Control Slide 64Process to process delivery UDP and TCP

    States for TCP

    State Description

    CLOSED There is no connection.

    LISTEN The server is waiting for calls from the client.

    SYN-SENT A connection request is sent; waiting for acknowledgment.

    SYN-RCVD A connection request is received.

    ESTABLISHED Connection is established.

    FIN-WAIT-1The application has requested the closing of the

    connection.

    FIN-WAIT-2 The other side has accepted the closing of the connection.

    TIME-WAIT Waiting for retransmitted segments to die.

    CLOSE-WAIT The server is waiting for the application to close.

    St t t iti di

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    65/77

    System Programming and Computer Control Slide 65Process to process delivery UDP and TCP

    State transition diagram

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    66/77

    Sender buffer

  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    67/77

    System Programming and Computer Control Slide 67Process to process delivery UDP and TCP

    Sender buffer

    Receiver window

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    68/77

    System Programming and Computer Control Slide 68Process to process delivery UDP and TCP

    Receiver window

    Sender buffer and sender window

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    69/77

    System Programming and Computer Control Slide 69Process to process delivery UDP and TCP

    Sender buffer and sender window

    Slidi th d i d

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    70/77

    System Programming and Computer Control Slide 70Process to process delivery UDP and TCP

    Sliding the sender window

    E di th d i d

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    71/77

    System Programming and Computer Control Slide 71Process to process delivery UDP and TCP

    Expanding the sender window

    Sh i ki th d i d

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    72/77

    System Programming and Computer Control Slide 72Process to process delivery UDP and TCP

    Shrinking the sender window

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    73/77

    System Programming and Computer Control Slide 73Process to process delivery UDP and TCP

    I n TCP, the sender window size is

    totally controlled by the receiver

    window value (the number of empty

    locations in the receiver buffer).

    However, the actual window size can

    be smaller if there is congestion in the

    network.

    Note:

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    74/77

    System Programming and Computer Control Slide 74Process to process delivery UDP and TCP

    Some points about TCPs sliding windows:

    Note:

    The source does not have to send a fullwindows worth of data.

    The size of the window can be increased ordecreased by the destination.

    The destination can send an acknowledgment

    at any time.

    L t t

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    75/77

    System Programming and Computer Control Slide 75Process to process delivery UDP and TCP

    Lost segment

    L k l d

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    76/77

    System Programming and Computer Control Slide 76Process to process delivery UDP and TCP

    Lost acknowledgment

    TCP timers

    http://www.apiit.edu.my/http://www.apiit.edu.my/
  • 8/12/2019 UCTI SPACC 04 Process to Process Delivery UDP and TCP

    77/77

    TCP timers

    http://www.apiit.edu.my/http://www.apiit.edu.my/