Skip to main content

TCP and UDP

TCP (Transmission Control Protocol): Connection oriented#

TCP three way handshake#

  • SYN
  • SYN ACK
  • ACK

TCP four way disconnect#

  • FIN
  • FIN ACK
  • FIN
  • FIN ACK

TCP reset#

  • RST

TCP uses#

  • Sequence numbers and acknowledgment numbers for the data being sent
  • Is a reliable protocol for sending data

UDP (User Datagram Protocol): Connectionless#

UDP#

  • Used when the handshake overheads are unnecessary
  • Quicker and less reliable protocol to send and receive data
  • DNS uses UDP

Transport layer addressing: Port numbers#

  • The source and destination port numbers are used by the transport layer protocols
  • Ports are used for identifying the application layer protocol
  • There two main categories of port numbers:
    • Server port numbers:
      • Well known: 0 - 1023
      • Registered: 1024 - 49,151
    • Client port numbers:
      • Ephemeral: 49,152 - 65,535
  • The source and destination port numbers are specified in the TCP header which is called segment header