What Is TCP/IP? TCP vs UDP, the TCP/IP Layers and How It Works

Sunucun 3 min read

TCP/IP is the suite of communication protocols the internet and most local networks run on. It is named after its two key protocols: IP (Internet Protocol) addresses and routes packets to their destination, and TCP (Transmission Control Protocol) makes sure they arrive complete, in order and without errors. Loading a web page, sending email or connecting to a server over SSH all happen over TCP/IP.

Illustration: What Is TCP/IP? TCP vs…

The TCP/IP Layers

The TCP/IP model (RFC 1122) has four layers. Data gains a header at each layer on the way down and is unwrapped in reverse on the other side.

LayerRoleExample protocolsOSI equivalent
ApplicationServices used by programsHTTP/HTTPS, DNS, SMTP, IMAP, FTP, SSHApplication, Presentation, Session (7-5)
TransportData between applications, port numbersTCP, UDPTransport (4)
InternetAddressing and routingIPv4, IPv6, ICMPNetwork (3)
LinkDelivery on the same physical networkEthernet, Wi-Fi, ARPData link, Physical (2-1)

The 7-layer OSI model is a reference model used in teaching; real internet protocols follow the TCP/IP model.

What Is TCP and How Does It Work?

TCP is connection-oriented. Before sending data, both sides set up a connection with the three-way handshake:

  1. The client sends SYN.
  2. The server replies SYN-ACK.
  3. The client sends ACK; the connection is open.

TCP then numbers segments, waits for acknowledgements, retransmits lost data and adapts its sending rate (flow and congestion control). That reliability adds a little latency. TCP’s current specification is RFC 9293, published in 2022.

TCP vs UDP

TCPUDP
ConnectionHandshake firstConnectionless
ReliabilityAcknowledgements, retransmission, orderingNo guarantee; lost packets aren’t resent
OverheadHigherLighter, lower latency
Used forWeb (HTTP/1.1, HTTP/2), email, file transfer, SSHDNS queries, live audio/video, games, VoIP, QUIC/HTTP/3

Think of TCP as registered mail and UDP as an ordinary letter. In games or video calls a late packet is useless, so UDP is preferred. HTTP/3 uses QUIC, which runs over UDP and provides reliability itself.

IP Addresses and Ports

The IP address gets the packet to the right device; the port number gets it to the right application. A web server listens on TCP 443 for HTTPS and TCP 22 for SSH; DNS mostly uses UDP 53. An IP address plus a port forms a socket (e.g. 203.0.113.10:443). See what is an IP address and what is a port.

Useful Commands

  • ping example.com: reachability and latency via ICMP (see what is ping).
  • tracert (Windows) / traceroute (Linux, macOS): routers on the path.
  • ipconfig /all (Windows) or ip addr (Linux): IP settings.
  • netstat -an or ss -tulpn on Linux: open TCP/UDP connections and listening ports.

On your own server you decide which ports are open with the firewall. See our VDS server and VPS server plans.

Frequently Asked Questions

Is TCP/IP a program?

No. It is a set of protocols built into Windows, macOS, Linux, Android and iOS; nothing to install.

Which is faster, TCP or UDP?

UDP has less overhead and lower latency but no delivery guarantee. Use TCP where correctness matters (web, files, email) and UDP for real-time traffic.

Where do I change TCP/IP settings?

On Windows: Settings > Network & internet > your connection > IP assignment, for IP, subnet mask, gateway and DNS. Automatic (DHCP) is right for most home users.

Categories

Latest guides