CSCE 790 Computer Network Security

Document Sample
CSCE 790 Computer Network Security Powered By Docstoc
					          CSCE 515:
Computer Network Programming

         Chin-Tser Huang

     University of South Carolina
Transmission Control Protocol (TCP)

   A connection-oriented transport layer
   Transmit byte streams between both
    ends of connection
        Full-duplex service
   Provide reliable service

2/26/2004                                   2
Reliability of TCP
   Application data is broken into best sized chunks to
    send, called TCP segment
   TCP sends acknowledgment for data received from
    other end of connection
   TCP maintains a timer for each segment
        Segment retransmitted if no acknowledgment in time
   TCP maintains an end-to-end checksum on its header
    and data
        If checksum of received segment is invalid, discard the

2/26/2004                                                          3
Reliability of TCP (cont’d)
   TCP resequences out-of-order data
    before passing them to the application
   TCP discards duplicate data
   TCP provides flow control
        TCP only allows other end to send as much
         data as it has buffer for

2/26/2004                                        4
TCP Header
       0                           15 16                      31

            source port number           destination port number

                           sequence number

                     acknowledgment number                         20 bytes
                           U A P R S F
                reserved   R C S S Y I
                           G K H T N N
                                              window size
              TCP checksum                   urgent pointer

                             option (if any)

                              data (if any)

2/26/2004                                                                     5
TCP Connection Establishment
     Three-way handshake
     1.     Client sends a SYN segment specifying server’s
            port number and client’s initial sequence number
     2.     Server responds with a SYNACK segment
            containing server’s ISN and acknowledging
            client’s SYN (client’s ISN+1)
     3.     Client responds with an ACK segment
            acknowledging server’s SYN (server’s ISN+1)

2/26/2004                                                  6
TCP Connection Termination
   Need four segments to terminate a
    connection because of TCP’s half-close
   Either end can send a FIN when it finishes
    sending data
        The end sending first FIN performs active close
         and the other end performs passive close
        A TCP can still send data after receiving FIN
   When receiving a FIN, respond with an ACK
    of received sequence number plus 1
2/26/2004                                                  7
Next Class
   TCP data flow
   Read TI Ch. 19, 20

2/26/2004                8

Shared By: