Lecture37 TCPConnectionMgmt

Document Sample
Lecture37 TCPConnectionMgmt Powered By Docstoc
					Computer Networks                                                                                   Prof. Hema A Murthy



   TCP FSM                                                                                 Connect / syn
                                                  closed
                       Passive open/ syn                                                          Active open/ syn
                                                                    Close /-
                       (server)                                                                   (client)
                                          Listen         Close /-
             Syn / Syn+ACK

                                      rst / -      Listen     Send/ syn             Syn
                    Syn
                    rcvd                          Passive open                      sent
                                                Syn/ syn+ack
                                                  Simultaneous open

                              a ck
                                     /-                             data
                                                                                 + ack
                                                                             n
      Close file           Close / fin               Estd                  Sy
                                                                                k        Three way handshake
                                                                             ac

                                                                    fin   /ack

Indian Institute of Technology Madras
Computer Networks                                                                  Prof. Hema A Murthy




   TCP FSM                                           Estd




                                          in
                                        /f
                                                              simultaneous close




                                   se
                                lo
                              C
                                                                       Close
                                        fin /ack                       wait
                      fin                           Closing
                      wait 1
                                   fin /ack             ack               Close / fin
                    ack              ack            Time
                                                    dnwait              Wait
                      fin
                                                           2MSL         ack
                      wait 2             fin /ack      Timeout
                                                                               Passive close
                                                     closed
             Active close                                            Ack/-


Indian Institute of Technology Madras
Computer Networks                                                        Prof. Hema A Murthy




               TCP Connection Management
    Three Way handshake:


                     host1                                       host2


                                           CR(seq
                                                   = x)
                                                             )
                                                       c k=x
                                                  y, a
                                             (seq=
                                        ac k

                                    Data (seq=x
                                                ,      ack=y)
Indian Institute of Technology Madras
Computer Networks                                                                     Prof. Hema A Murthy


 Delayed Duplicates
                                             X Old duplicate from released connection
                                                    CR       (seq=
                                                                        x)
                                                              x)             h2
                          h1                          y, ack=
                                                   q=
                    W/o h1’s               A ck(se
                                                    Re
                                                      je c
                    knowledge                             t (a
                                                                 ck=
                                                                       y)

                                                         f h2
                                    CR (
                                           seq=
                                               x)

Old duplicate
                                       y)
                               x, seq=                  No TPDUs with             seqy to be
                          ack=
                                     f Data(seq =       acknowledged
              h1                Old du           x, ac
                                        plicate       k=z)
                        Reje
                            ct(ac
                                  k=y)
Indian Institute of Technology Madras
Computer Networks                                        Prof. Hema A Murthy




                          Releasing Connections
         • Symmetric
                – requires each to release separately
         • Asymmetric
                – similar to the telephone system
                – A party hangs up connection broken
         • Symmetric
                – When everything goes well fin
                – If all’s not well requires a timeout

Indian Institute of Technology Madras
Computer Networks                                                  Prof. Hema A Murthy




                    TCP Disconnection
                                                              h2
                                         CR
                  h1


                                        ACC

                                         data
                                        data



                                                DR
                                         data



                                           Data in transit does
                                           not reach
Indian Institute of Technology Madras
Computer Networks                                                       Prof. Hema A Murthy




                     TCP Disconnection Request

             Send DR + time set
   h1                                   DR         Send DR + time set
                                                                         h2
                                         DR
                             Release
                                         ack
                          Send ack                 release



   h1                                                                   h2
                                        DR

                                         DR


                                         ack
                                               X
                                                   Time out   release
Indian Institute of Technology Madras
Computer Networks                                              Prof. Hema A Murthy




            TCP Disconnection Request
                             h1                           h2
                                          DR

                           timeout
                                          DR
                                          X
                                          DR

                                          DR

                                release   ack

                                                release

Indian Institute of Technology Madras
Computer Networks                                               Prof. Hema A Murthy




           TCP Disconnection Request
                          h1                        h2
                                        DR



                                         X
                                        DR   Time out release
                                         X
                        Time out




Indian Institute of Technology Madras
Computer Networks                                                       Prof. Hema A Murthy




                     TCP Transmission Policy
                                                            0 Buffer2k
              2k write                    2k        Seq=0     Empty
                                                     ,
                                               Ack=2k        2k
                                               W=2k
                                                                        receiver
    sender
         2k write
                                          2k Seq=
                                                 2k
                                                             Empty
                                          Ack= W=0          App. reads 2k
                                          4k
                                                                   2k
                                          Ack= W=0
             Sender                       4k
             blocked
                                         1k

                                        Seq
                                              =4k            1k    2k
Indian Institute of Technology Madras
Computer Networks                                                 Prof. Hema A Murthy




                       TCP Congestion Control
         • Receiver buffer size
                – Network characteristics
                – Sender maintain window size for transfer
                      • Window size granted by receiver(rcvr window)
                      • Congestion window (cgst window)
                      • Number bytes sent min (rcvr window, cgst window)



Indian Institute of Technology Madras
Computer Networks                                         Prof. Hema A Murthy




          TCP Congestion Control (contd.)
         • Can optimise send and receive
                – Buffer data until 4K and then write
                – Window size update until enough space

         • Issues: 1 byte send – update window by 1
           byte
                – - avoidance of silly window syndrome


Indian Institute of Technology Madras
Computer Networks                                                Prof. Hema A Murthy




                       TCP Congestion Control
         • Congestion window set max size of
           segment in use
                – Send maximum segment
                – Double segment if ack received – until timeout
                      • Set congestion window to previous maximum size




Indian Institute of Technology Madras
Computer Networks                                                      Prof. Hema A Murthy




          TCP Congestion Control (Contd.)
                – Additionally use threshold parameter
                      • Initially 64k
                      • Timeout occurs, set threshold to half of current
                        congestion window
                      • Reset congestion window to maximum segment size
                      • Repeat process again
                      • Threshold reached – increase window linearly until
                        timeout


Indian Institute of Technology Madras
Computer Networks                                        Prof. Hema A Murthy




                                        TCP Slow Start

                                           Timeout
                    Threshold
        32




Indian Institute of Technology Madras
Computer Networks                                                         Prof. Hema A Murthy




                       TCP Timer Management
       • Difficult compared to DLL
              – What is RTT?
              – On top of IP which is connectionless

           RTT                          = RTT            + (1-a ) M
            estimated RTT                Current value     time for ack
           a - is a constant




Indian Institute of Technology Madras
Computer Networks                                                   Prof. Hema A Murthy




                       TCP Timer Management
         • Also use Deviation D
         •     D = D + (1-a) | RTT – M |
         • Timeout = RTT + 4 * D
         • Issues – retransmitted frames?
                – Solution – Do not update RTT for Transmitted
                  segment
                – Just double RTT
                – Persistence timer
                      • Sender blocked, but receiver window update lost
Indian Institute of Technology Madras
Computer Networks                                                      Prof. Hema A Murthy




                       TCP Timer Management
            • Persistence timer
                    – Sender blocked, but receiver window update
                      lost
            • Keepalive timer
                    – Both ends check health of connection
            • Timed wait state in TCP
                    – max lifetime of packet
                         • ensures all packets created by a connection are
                           dead after connection is closed


Indian Institute of Technology Madras

				
About if any file u wil find copyright contact me it will be remove in 3 to 4 buisnees days. add me on sanjaydudeja007@gmail.com or visit http://www.ohotech.com/