• HWIKI

    Build. Break. Explain.

    Understand Transport Protocols (UDP and TCP)

    There are 2 types of transport protocols:

    • TCP: Transmision Control Protocol
    • UDP: User Datagram Protocol

    TCP is a trusted protocol. Contrary to UDP.

    UDP:

    This protocol is called BEST EFFORT => i.e. it guarantees maximum use of Bandwidth.

    UDP header:

    Source Port (16bits) Destination Port (16bits)
    Length (data size) Checksum (16bits) (Check packet integrity)

    Software port: These are virtual gates between the internal and external network. There are 65535 of them.

    The most important:

    • SSH: 22
    • HTTP: 80
    • HTTPS: 443
    • DNS: 53
    • DHCP: 67/68
    • PROXY: 8080

    A UDP data packet is cut into MAXIMUM 1500 bytes/packet.

    Example: A 5KB packet = 5000 bytes. => 3 packets of 1500 bytes + 1 packet of 500 bytes.

    TCP:

    Handshake three way:

    Popularized version :

    1. Sender -> Receiver: I want to talk to you
    2. Receiver -> Sender: I accept, but I also want to talk to you.
    3. Sender -> Receiver: Let's talk together.

    Technical version :

    1. Sender -> Receiver: SYN ; SEQ=1
    2. Receiver -> Sender: ACK=1 ; SYN, SEQ=100
    3. Sender -> Receiver: SYN, ACK=2, SEQ=2

    SYN = SYNCHRONIZATION SEQ = SEQUENCE ACK = ACKNOWLEGMENT => Acknowledgement of receipt.