How a Connection Is Established

GoSetup TeamFebruary 22, 202660 views

In the previous part, we explained how a device joins a network.

Now assume:

  • the device already has an IP address
  • it knows its subnet mask
  • it knows its default gateway
  • it knows its DNS server

A user opens a browser and types: www.google.com

What happens next? Let's break down the connection establishment process step by step.

1. DNS — Resolving a Domain Name to an IP Address

Networks do not understand domain names. They operate using IP addresses.

When you enter: www.google.com your device must first determine the server's IP address.

This is handled by DNS (Domain Name System).

The process:

  1. The device sends a DNS query to the configured DNS server.
  2. The DNS server responds with the corresponding IP address.

For example:

google.com → 142.250.190.78

Only after the IP address is known can a network connection begin.

DNS typically uses UDP on port 53, although it may use TCP in certain situations.

2. Selecting the Transport Protocol

Once the IP address is known, the connection process continues.

Application data is passed to a transport protocol.

There are two primary transport protocols:

  • TCP
  • UDP

TCP — Transmission Control Protocol

TCP is used when reliability is required.

It provides:

  • connection establishment
  • delivery acknowledgment
  • packet ordering
  • retransmission of lost data

Web traffic (HTTP/HTTPS) uses TCP.

UDP — User Datagram Protocol

UDP is simpler and faster.

It:

  • does not establish a connection
  • does not guarantee delivery
  • does not ensure ordering

It is commonly used for:

  • video streaming
  • online gaming
  • VoIP
  • DNS queries

3. Ports — Identifying the Service

An IP address identifies a device. A port identifies a specific process or service on that device.

A port is a 16-bit number (0–65535).

For example:

142.250.190.78:443

Port 443 corresponds to HTTPS.

When your browser initiates a request, it uses a temporary (ephemeral) port.

Example connection:

192.168.1.25:51534 → 142.250.190.78:443

Here:

  • 192.168.1.25 — your device's IP
  • 51534 — the browser's source port
  • 142.250.190.78 — the server's IP
  • 443 — HTTPS service

4. Socket — The Combination of IP and Port

A connection endpoint is defined by: IP + Port

This combination is called a socket.

For example:

192.168.1.25:51534

This represents a specific process running on a specific device.

Communication between two endpoints is defined by two sockets:

Client IP:Port ↔ Server IP:Port

5. TCP Three-Way Handshake

Before data transmission begins, TCP establishes a connection.

This occurs in three steps:

  1. SYN — the client initiates the connection
  2. SYN-ACK — the server acknowledges
  3. ACK — the client confirms

Only after this handshake is complete does data transmission begin.

This process ensures that both sides are ready and synchronized.

6. Building the Transport Segment

Once the connection is established:

  1. The application generates data (for example, an HTTP request).
  2. TCP adds a transport header containing:
    • source port
    • destination port
    • sequence numbers
    • control flags
  3. A TCP segment is formed.

This segment is then passed down to the IP layer for routing.

7. What We Have So Far

At this stage:

  • the domain name has been resolved to an IP address
  • a transport protocol has been selected
  • service ports have been identified
  • a connection has been established (for TCP)
  • a transport segment has been created

The data is now ready to travel across the network.

Conclusion

Establishing a connection is not simply "opening a website."

It is a structured process:

  1. DNS resolves the domain name
  2. TCP or UDP determines the transmission method
  3. Ports identify the service
  4. TCP establishes the connection
  5. A transport segment is created

Only after these steps does data begin moving across the network.

Found this helpful? Share it!

Stay Updated

Get notified about new articles

No spam. Unsubscribe anytime.