<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: vigneshgs271096</title>
    <description>The latest articles on DEV Community by vigneshgs271096 (@vigneshgs271096).</description>
    <link>https://dev.to/vigneshgs271096</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1402810%2F88095eb3-23b1-481f-bc31-6e1b8054e4de.jpeg</url>
      <title>DEV Community: vigneshgs271096</title>
      <link>https://dev.to/vigneshgs271096</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vigneshgs271096"/>
    <language>en</language>
    <item>
      <title>Quick Learn Docker</title>
      <dc:creator>vigneshgs271096</dc:creator>
      <pubDate>Sun, 30 Aug 2026 13:10:10 +0000</pubDate>
      <link>https://dev.to/vigneshgs271096/quick-learn-docker-1f1</link>
      <guid>https://dev.to/vigneshgs271096/quick-learn-docker-1f1</guid>
      <description>&lt;p&gt;&lt;strong&gt;Why Docker?&lt;/strong&gt;&lt;br&gt;
Docker is a tool that packages the application we develop along with the dependencies it needs. Why do we package it like this? Software needs dependent libraries, tools, settings, and runtimes. To run the software on another machine, we need the same versions of the dependencies as those used when we create it.&lt;/p&gt;

&lt;p&gt;**Overall Concepts to Know while working with Docker&lt;/p&gt;

&lt;p&gt;Dockerfile       -&amp;gt;         Docker image      -&amp;gt;        Container**&lt;/p&gt;

&lt;p&gt;A Dockerfile is a saved, shareable instruction file. We use the Docker CLI to send this file to the Docker Daemon. The Daemon reads the instructions and builds a Docker Image (the packaged software/template). We can then use the CLI to tell the Daemon to run multiple Containers (the live applications) from that single Image.&lt;/p&gt;

&lt;p&gt;If we need to start many containers and the containers have to communicate with each other for many practical uses. To define containers with details to start, stop, and manage the container lifecycle ( Orchestration ) and communicate with each other ( Networking ), we use a docker-compose file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VM vs Docker&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa4aqq3zii8002ikl59lf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa4aqq3zii8002ikl59lf.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each virtual machine displayed above acts like a completely different computer inside real computers.&lt;/p&gt;

&lt;p&gt;Virtual machine architecture starts with the hypervisor, which takes part( abstracts and allocates, or we can call it partitions) of the machine's hardware and prepares virtual hardware. A  guest OS runs inside each VM to run applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi9cfmqqtvy6fsgq2jtme.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi9cfmqqtvy6fsgq2jtme.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unlike VMs, Docker containers don’t need a heavy Guest OS. Instead, they share the Host OS Kernel. By using Linux features like Namespaces, Docker creates an isolated environment (specific folders, networks, and files) where the process thinks it is running alone. Because Linux containers require a Linux kernel, running them on Windows or Mac requires Docker Desktop to spin up a single, lightweight Linux VM in the background, and all containers share that VM's kernel.&lt;/p&gt;

&lt;p&gt;When we start a container, the Docker daemon starts a standard process but wraps it in two Linux features: &lt;strong&gt;Namespaces&lt;/strong&gt; to isolate what the process can see, and &lt;strong&gt;cgroups&lt;/strong&gt; to limit the CPU and RAM it can use. Because of this namespace isolation, the process has two identities: a standard PID assigned by the host OS, and an isolated PID (usually PID 1) inside the container's own namespace.&lt;/p&gt;

&lt;p&gt;Commands&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. docker run –– name container1 ubuntu&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The docker run ubuntu command tells Docker to run the latest version of the Ubuntu image. Docker first searches its local image cache on your machine. If the image is not found there, it reaches out to a Docker Registry (like Docker Hub), downloads the image to your cache, and then runs it as a container. If we didn’t mention its name by flag (–name &amp;lt; our name&amp;gt;), Docker assigns some random name to the container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker run –– name container1 -d ubuntu&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If we start the container, the terminal is active, and logs are printed from the container. To use the same terminal for various uses, use the detach flag.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker run –– name container1 ubuntu:4.0&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can specify a version instead of the latest version.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker run –– name container1 -p 80:5000 ubuntu:4.0&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We map host port 80 to the container’s app port 5000. From the outside world, we can communicate through the host port 80.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker run –– name my-db -v /opt/datadir:/var/lib/mysql mysql&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Containers are temporary and disposable. So if we store the DB inside the container, it is not recoverable. We can map the host folder to the container folder.&lt;br&gt;
**&lt;br&gt;
Container Folder = /var/lib/mysql&lt;/p&gt;

&lt;p&gt;Host Folder = /opt/datadir**&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker run -e APP_COLOUR=blue kodekloud/simple-webapp&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is an environment variable, APP_COLOUR; we can use it in our container&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker ps&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can see all the active containers.&lt;br&gt;
**&lt;br&gt;
docker ps -a**&lt;/p&gt;

&lt;p&gt;We can see all the containers, including inactive ones&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker start container1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Start the container&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker stop container1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Stops the container&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker rm container1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Deletes the container&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker images&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Lists all the images&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker rmi nginx&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Removes the image&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker pull ubuntu&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Just pulls the image from Docker Hub, without running it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker exec -it container1 sh&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It opens the container ubuntu, execute the command sh.&lt;/p&gt;

&lt;p&gt;-i (Interactive): Keeps the input stream (STDIN) open so you can type.&lt;br&gt;
-t (TTY): Allocates a fake terminal screen so it looks and acts like a normal command prompt. Together (-it), they give you an interactive shell.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker inspect container1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Details about the container&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker logs container1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Prints out what the application has printed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Dockerfile&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; ubuntu:latest&lt;/span&gt;

&lt;span class="c"&gt;# Update OS and install Python&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; python3 python3-pip

&lt;span class="c"&gt;# Install the exact Flask version needed&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;pip3 &lt;span class="nb"&gt;install &lt;/span&gt;&lt;span class="nv"&gt;Flask&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;2.0.1

&lt;span class="c"&gt;# Set the folder and copy your laptop's code into the image&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /opt&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . /opt&lt;/span&gt;

&lt;span class="c"&gt;# The command to run when the container starts&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["python3", "-m", "flask", "run", "--host=0.0.0.0"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Dockerfile instructs the Docker daemon to start from the Ubuntu base image, and within that environment, we use RUN to install packages. We use WORKDIR to tell Docker to create a folder at /opt/home and execute all subsequent commands from that directory. We then copy the code from our host directory directly into that workspace. Finally, when we start the container, it executes the command provided inside the CMD array.&lt;/p&gt;

&lt;p&gt;CMD is a flexible suggestion; the user can override CMD, as explained in the image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run my-app bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, when running the container, by default it has to run python3 -m flask –host=0.0.0.0, but we override it with bash. When the container is started, it won’t start the Flask app; it will start bash. So we can use an ENTRYPOINT array, which prevents the command from being overridden. We can use a combination of them to our advantage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Lock in the main program &lt;/span&gt;
&lt;span class="k"&gt;ENTRYPOINT&lt;/span&gt;&lt;span class="s"&gt; ["python3", "app.py"] &lt;/span&gt;
&lt;span class="c"&gt;# Provide a default argument &lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["--port=8080"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, the runtime command is fixed as python3 app.py, but the port can be overridden.&lt;/p&gt;

&lt;p&gt;Docker has a layered architecture; instructions that add or change files (RUN, COPY, ADD) create actual filesystem layers. Commands like ENTRYPOINT, CMD, or ENV just add lightweight metadata to the configuration, not physical layers&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Layer 1 (Base Ubuntu Layer): The heavy foundation.
Layers 2 &amp;amp; 3 (apt and pip packages): The installed tools stacked on top.
Layer 4 (Source Code): Your actual application files.
The metadata telling Docker how to behave (Entrypoint): The final startup instructions.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the image is built, the underlying layers of the image are already created and read-only. The Docker daemon has a cache of every layer and can reuse it when rebuilding the image. For example, if you alter the source code ( 4th layer ), Docker won’t start rebuilding from scratch from Layer1. It will start from the 4th; it can recognise that the top 3 layers are unchanged, and it has the cache of the layers to reuse. So it will build layer 4 and the metadata step.&lt;/p&gt;

&lt;p&gt;On top of this, there is a temporary, read-and-write container layer above all read-only stable image layers. It is like placing a glass board on top of the book; we can scribble anything on top of the glass board. It creates an illusion of changing the book, but in reality, the book is static. If the container is deleted, this layer’s memory is lost. This is the reason it is termed temporary. It uses Copy-on-Write to create an illusion of changing files in the container layer. Please research it separately if you want more detail, but this abstraction is enough to work with Docker.&lt;/p&gt;

&lt;p&gt;To save permanently on the host file system, use volumes, which were discussed above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;docker run -d -v ./Downloads/db:/var/lib/mysql mysql&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If we are building a simple API for an online store, we create two microservices: a database and a backend process containing the business logic. If a customer requests to see products, the backend queries the database and returns the result to the client. Without Docker, these processes use a socket address (IP + PORT) to establish a connection. In Docker, we use a network abstraction.&lt;/p&gt;

&lt;p&gt;By default, the Docker daemon acts as a router/gateway. It assigns a dynamic IP to each container and places them in the default bridge network. These dynamic IPs can be used for communication, but they change every time a container restarts.&lt;/p&gt;

&lt;p&gt;To overcome this, the Docker daemon has an embedded DNS that resolves container names into IPs, allowing containers to communicate using just their names. However, this DNS feature does not work on the default bridge network. To use it, we must create a user-defined network and place both of our containers inside it.&lt;/p&gt;

&lt;p&gt;We can bind a port on the host machine to the process inside the container. This is called port binding. It opens a doorway so the external world can communicate with the container, allowing users to access the API or web server running inside it.&lt;/p&gt;

&lt;p&gt;docker network create my-store-network&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Start the database and put it on the network&lt;/span&gt;
docker run -d --name my-database --network my-store-network mysql

&lt;span class="c"&gt;# Start the web server and put it on the exact same network&lt;/span&gt;
docker run -d --name my-web-server --network my-store-network my-python-app

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;OLD WAY without Docker&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# The web app connects to the database installed directly on your laptop
&lt;/span&gt;&lt;span class="n"&gt;db_connection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mysql&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;localhost&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;admin&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;my-secret-pw&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3306&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Docker way&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# The web app connects to the separate database container
&lt;/span&gt;&lt;span class="n"&gt;db_connection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mysql&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;my-database&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# &amp;lt;--- Notice this change!
&lt;/span&gt;    &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;admin&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;my-secret-pw&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3306&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have already discussed the volume above&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#Create volume&lt;/span&gt;
docker volume create data_volume

&lt;span class="c"&gt;# Use the volume&lt;/span&gt;
docker run &lt;span class="nt"&gt;-v&lt;/span&gt; data_volume:/var/lib/mysql mysql

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Data_volume is a permanent folder on the host. /var/lib/mysql is a folder in the container.&lt;/p&gt;

&lt;p&gt;There are two main ways to persist data in Docker. Volumes are entirely managed by the Docker daemon and stored in a hidden area on the host. Bind Mounts allow you to map a specific, known folder on your host machine directly into the container(-v /opt/datadir:/var/lib/mysql). With a bind mount, Docker doesn't copy or sync files; it simply allows the container to read and write directly to that exact host folder in real-time. The modern way to attach either of these in the CLI is by using the explicit --mount flag.&lt;/p&gt;

&lt;p&gt;Docker compose&lt;/p&gt;

&lt;p&gt;In the example image, we need 5 containers. A Python app for people to vote and update an in-memory Redis DB; from this in-memory DB, the .NET worker gets the data and updates the actual Postgres DB. The Postgres app was fetched to show the result in the Node.js result app. This single file helps to orchestrate multiple containers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq8ct7tbqnh7splmkqcoi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq8ct7tbqnh7splmkqcoi.png" alt=" "&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;vote&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dockersamples/examplevotingapp_vote&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;5000:80"&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;front1&lt;/span&gt;

  &lt;span class="na"&gt;redis&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;redis:alpine&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;front1&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;back1&lt;/span&gt;

  &lt;span class="na"&gt;worker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dockersamples/examplevotingapp_worker&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;back1&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;back2&lt;/span&gt;

  &lt;span class="na"&gt;db&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres:15-alpine&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;POSTGRES_PASSWORD=postgres&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;db-data:/var/lib/postgresql/data&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;back2&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;front2&lt;/span&gt;

  &lt;span class="na"&gt;result&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dockersamples/examplevotingapp_result&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;5001:80"&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;front2&lt;/span&gt;

&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;db-data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

&lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;front1&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;front2&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;back1&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;back2&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are some commands for a Dockerfile&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up &lt;span class="nt"&gt;-d&lt;/span&gt;

&lt;span class="c"&gt;#Start all the containers without a live terminal&lt;/span&gt;

docker compose ps

&lt;span class="c"&gt;#List of all containers&lt;/span&gt;

docker compose logs &lt;span class="nt"&gt;-f&lt;/span&gt; vote

&lt;span class="c"&gt;#Logs of the container from the vote app&lt;/span&gt;

docker compose down

&lt;span class="c"&gt;#Stop all the containers&lt;/span&gt;

docker compose up &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--build&lt;/span&gt;

&lt;span class="c"&gt;#Rebuild all the containers&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Docker Hub is a popular public container registry used widely for open-source images. For enterprise security, organizations usually host their own private registries (like AWS ECR or a self-hosted Docker Registry). We push our built images to these registries, and our servers pull those images to run them as containers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker login registry.mycompany.com

docker tag my-api:latest username/my-api:v1.0

docker push username/my-api:v1.0

docker pull username/my-api:v1.0 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>containers</category>
      <category>devops</category>
      <category>backenddevelopment</category>
      <category>docker</category>
    </item>
    <item>
      <title>How can people use the internet without IPs?</title>
      <dc:creator>vigneshgs271096</dc:creator>
      <pubDate>Wed, 26 Aug 2026 13:03:02 +0000</pubDate>
      <link>https://dev.to/vigneshgs271096/how-can-people-use-the-internet-without-ips-j9m</link>
      <guid>https://dev.to/vigneshgs271096/how-can-people-use-the-internet-without-ips-j9m</guid>
      <description>&lt;p&gt;Highly recommend you read the previous article and spend time understanding IPs, sockets, and ports.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why URL ?&lt;/strong&gt;&lt;br&gt;
Suppose an application is running on our computer and needs the IP and port of another application to communicate over the internet. But remembering IP addresses is hard, so we use human-readable names to name computers, which computers don’t understand, but we use a middleman called DNS to map the name to machine-readable numbers ( IP ). In addition to the computer's name, we need other kinds of information to communicate, like which PORT the server is running on and which application-level protocol we are using; we need to communicate what all the resources we need from the server, etc., so a URL is the standard way to represent the information needed to communicate with other computers, which is agreed globally.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The main Idea of protocols&lt;/strong&gt;&lt;br&gt;
I live in Chennai, India. If people get into a cab and tell the driver a location like “Chennai Central Railway Station”, the driver gets the exact location the passenger wants to go to. He doesn’t need to know the full address or geolocation. If the passenger and driver were both locals, they would both agree that the phrase  “Chennai Central Railway Station” is the particular location through their experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Master Format:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;://:@:/;?#&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scheme (How are we connecting?)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From the previous article, we know that simply by knowing the IP ( host name )and PORT, we can able to create a socket connection. But the goal of a connection is to transfer resources/services from the server to the client. To achieve this, we need to transfer large amounts of data using a universally agreed standard to communicate. When we are building a server and client using TCP/UDP sockets, we have to write some extra logic for the standard that both party agrees.&lt;/p&gt;

&lt;p&gt;Example &lt;br&gt;
Let me build my own simple application protocol&lt;/p&gt;

&lt;p&gt;The request from the client has to mention the type of the file, like jpg, txt, etc and on the next line I add txt, jpg, or binary file. I know the request format is going to come in the format and file from the server side; I can easily code to take the format, take the file from the next line, and save it as a file with its actual format, e.g., dummy.jpg&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# socket is tool by OS to abstract network connection
import socket

# create a socket of IPV4 and TCP
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# giving the socket ip and port
server.bind(('127.0.0.1', 8080))
# telling the os to prepare connection , max 1
server.listen(1)
print("Server waiting for connection...")

# sever listen , when got request, create a dedicated connectionSocket for communication 
connectionSocket, clientAddress = server.accept()
# receves data
raw_data = connectionSocket.recv(4096)

# extract header of our protocol
header, first_chunk = raw_data.split(b'\n', 1)
extension = header.decode()

# create a file and save all the data in that file
filename = f"dummy.{extension}"
with open(filename, "wb") as f:
    f.write(first_chunk) # Write the body from the first packet

    # Keep receiving if the file is large
    while True:
        chunk = connectionSocket.recv(4096)
        if not chunk: break
        f.write(chunk)


# close the socket
print(f"Successfully saved {filename}")
server.close()
connectionSocket.close()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above one is a one-time server&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# socket is a tool provided by the OS to abstract network connections
import socket

# 1. Prepare data (Let's send a simple text file)
extension = "txt"
file_data = b"This is the content of my custom protocol file!"

# 2. Apply Your Protocol format: extension + \n + file_data
protocol_message = f"{extension}\n".encode() + file_data

# 3. Setup TCP Socket and Connect
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('127.0.0.1', 8080))

# 4. Send everything and close
client.sendall(protocol_message)
print("Message sent using custom protocol.")
client.close()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code is the client to connect to the server code&lt;/p&gt;

&lt;p&gt;Like the scheme we created above, there are globally accepted schemes: HTTP, FTP, SMTP, and database schemes(e.g., postgres://, mongodb://, redis://).&lt;/p&gt;

&lt;p&gt;**&lt;br&gt;
Host (Where is the server?)**&lt;br&gt;
We already discussed IP in depth, and the domain name is resolved to an IP. We already discussed this in our previous article in depth, so I’m skipping it with a link.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Path, query, and params&lt;/strong&gt; in the URL are used to convey the client's requirements to the server in different styles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.example-store.com/shop/shoes.html;color=red;size=10?sort=price&amp;amp;gender=mens#reviews" rel="noopener noreferrer"&gt;https://www.example-store.com/shop/shoes.html;color=red;size=10?sort=price&amp;amp;gender=mens#reviews&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here, the path is &lt;strong&gt;/shop/shoes.html&lt;/strong&gt;, which is used to specify that, in this store, we are interested in the shoe HTML on the server. &lt;/p&gt;

&lt;p&gt;Params are &lt;strong&gt;;color=red;size=10&lt;/strong&gt;, which tells the server that the client is interested in size 10 and red shoes.&lt;/p&gt;

&lt;p&gt;The query was &lt;strong&gt;?sort=price&amp;amp;gender=mens&lt;/strong&gt;, which tells the server to sort the page by price, and we were interested in men's shoes&lt;/p&gt;

&lt;p&gt;HTTPS is the scheme; from the scheme, we can derive that the default port is 443.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="http://www.example-store.com" rel="noopener noreferrer"&gt;www.example-store.com&lt;/a&gt;&lt;/strong&gt; is the domain name resolved by DNS into an IP address.&lt;/p&gt;

&lt;p&gt;For some schemes like ftp, we need a username and password.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#reviews&lt;/strong&gt; is the fragment here; this notation is used to indicate which part of the HTML document is viewed. Here, in the HTML page, the user views the review part. The fragment is useless for the server and is used as a bookmark.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How we use URLs practically&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We know about URLs now; we never type the full URL in the browser in our daily life, and web developers themselves won’t use the full URL during development.&lt;/p&gt;

&lt;p&gt;In the above example, this part &lt;strong&gt;&lt;a href="https://www.example-store.com" rel="noopener noreferrer"&gt;https://www.example-store.com&lt;/a&gt;&lt;/strong&gt; is the base URL; irrespective of what page/resource we see, this base URL has to be the same. The rest of the URLs, other than the base URL, are relative URLs&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/shop/shoes.html;color=red;size=10?sort=price&amp;amp;gender=mens#reviews&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The browser understands that the current page's base URL is the first part of the relative URL unless it is explicitly mentioned. Developers ( including myself ) build webpages using relative URLs; the base URL can be changed in one place if we are changing the domain name. I am personally part of the team building jewellery software, where we change theme colors, logo, and base URL to run. The remaining codes remain same; the company sold the same software to many jewellers.&lt;/p&gt;

&lt;p&gt;We observe that the browser is intelligent enough to suggest the URL when we half type with the help of browser history. The browser, like Google, Safari, etc have their website details in its database; if we search a related word, we see it in the result. If we click, we will go to the website. The question that comes to my mind is how Google's DB knows all its websites. The answer is that the website owners themselves expose it to Google, Safari, etc nobody wants to hide their website in e-commerce competition. Even if they don’t, google have crawler that crawls the internet's pages; if it finds any webpage link that it does not know, it will go to the website and try to crawl all its pages and save the important keywords that help the google to show the website for relevant searches in the browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;URL ENCODING AND DECODING&lt;/strong&gt;&lt;br&gt;
In this URL, we cannot use characters which was in other languages, or any special symbol which was not in ASCII, or any reserved words in a URL with a different meaning. So we have a workaround: the illegal characters mentioned here are converted to ASCII code, which is URL encoding. When the browser reads it, it knows it is some kind of special character, and on the receiving end of the request, it is decoded to normal form, called URL decoding. I will add the examples below.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Spaces (The most common)
You type: apple pie
Browser sends: apple%20pie&lt;/li&gt;
&lt;li&gt;Reserved Characters (To prevent confusing the server)
You type: Ben &amp;amp; Jerry (The &amp;amp; usually splits a query!)
Browser sends: Ben%20%26%20Jerry (The &amp;amp; becomes %26)
You type: 100%
Browser sends: 100%25 (The % becomes %25)&lt;/li&gt;
&lt;li&gt;Other Languages &amp;amp; Symbols
You type: café
Browser sends: caf%C3%A9
You type: hello 👋
Browser sends: hello%20%F0%9F%91%8B&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We have a question: if we encode to make the URL safe, why can’t we do it for the entire URL text except the special characters?&lt;br&gt;
The answer is no. The receiving side only expects special characters to be encoded and normal text to remain normal. Overdoing it here creates confusion.&lt;/p&gt;

&lt;p&gt;From the above and the past two articles, we know about the OS role in communication ( sockets ) and socket addresses ( IP + PORT). Now we know, as common users, why we don't see IPs in our next articles; we explore More about the application layer and how frameworks and libraries were built to make API calls.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>webdev</category>
      <category>programming</category>
      <category>api</category>
    </item>
    <item>
      <title>How are computers named on the internet: IPV4 and IPV6</title>
      <dc:creator>vigneshgs271096</dc:creator>
      <pubDate>Mon, 24 Aug 2026 05:04:46 +0000</pubDate>
      <link>https://dev.to/vigneshgs271096/how-are-computers-named-on-the-internet-ipv4-and-ipv6-1mfi</link>
      <guid>https://dev.to/vigneshgs271096/how-are-computers-named-on-the-internet-ipv4-and-ipv6-1mfi</guid>
      <description>&lt;p&gt;&lt;strong&gt;RECAP&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the last article, we discussed how two applications running on different computers on the internet communicate through IP addresses and Ports, and how the OS’s socket handles the hidden details of the communication network. In this chapter, we can go deeper into IPs.&lt;/p&gt;


&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/vigneshgs271096/how-computers-talk-to-each-other-a-beginnersguide-to-ip-ports-and-sockets-2hfg" class="crayons-story__hidden-navigation-link"&gt;How Computers Talk to Each Other: A Beginner's Guide to IP, Ports, and Sockets&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/vigneshgs271096" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1402810%2F88095eb3-23b1-481f-bc31-6e1b8054e4de.jpeg" alt="vigneshgs271096 profile" class="crayons-avatar__image" width="413" height="413"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/vigneshgs271096" class="crayons-story__secondary fw-medium m:hidden"&gt;
              vigneshgs271096
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                vigneshgs271096
                
                
              
              &lt;div id="story-author-preview-content-4365185" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/vigneshgs271096" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1402810%2F88095eb3-23b1-481f-bc31-6e1b8054e4de.jpeg" class="crayons-avatar__image" alt="" width="413" height="413"&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;vigneshgs271096&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/vigneshgs271096/how-computers-talk-to-each-other-a-beginnersguide-to-ip-ports-and-sockets-2hfg" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Aug 11&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/vigneshgs271096/how-computers-talk-to-each-other-a-beginnersguide-to-ip-ports-and-sockets-2hfg" id="article-link-4365185"&gt;
          How Computers Talk to Each Other: A Beginner's Guide to IP, Ports, and Sockets
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/api"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;api&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/crawler"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;crawler&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/webdev"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;webdev&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/computernetwork"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;computernetwork&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
            &lt;a href="https://dev.to/vigneshgs271096/how-computers-talk-to-each-other-a-beginnersguide-to-ip-ports-and-sockets-2hfg#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              

              &lt;span class="hidden s:inline"&gt;Add&amp;nbsp;Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            8 min read
          &lt;/small&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


&lt;p&gt;** Let's Start**&lt;/p&gt;

&lt;p&gt;When we ask an internet service provider for internet, we can get the router/modem connected to the external cable. After the setup, we can connect all the devices in our home and use the internet. But there is a logical system behind this magic. I will discuss it here.&lt;/p&gt;

&lt;p&gt;For computers, everything is binary: 1s and 0s. If we want to build a system for computers that identifies each other, we have to name each computer like places, people, etc. We cannot name them in the alphabet or with numbers like 1,2,3…, we have to name them in binary numbers.&lt;/p&gt;

&lt;p&gt;If we have a bit, it has only two options: 0 or 1. So we can name one computer 0 and another one 1. If we have 2 bits, we have 4 combinations.&lt;/p&gt;

&lt;p&gt;0  0&lt;br&gt;
0  1&lt;br&gt;
1  0&lt;br&gt;
1  1&lt;/p&gt;

&lt;p&gt;If we have n bits, we have ( 2n ) combinations, which can label 2n  computers. In the IPv4 standard, we have 4 decimal numbers separated by dots; each number is 8 bits. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5003a009w4jfodafq718.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5003a009w4jfodafq718.png" alt=" " width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we calculate the total number of devices that can be labelled by IPV4 is  4,294,967,296 (2³²). It is sufficient in the initial days, but as the number of devices that connect to the internet grows exponentially, we need to introduce a new method to connect a large number of devices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Subnetting&lt;/strong&gt; is dividing a larger network into many smaller networks, and &lt;strong&gt;NAT&lt;/strong&gt; is one of the solutions. We go back to the ISP: if we request an internet connection for home, very rarely ISP give a direct IP. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WAN ( wide area network )&lt;/strong&gt; is the network that connects globally, but we have limitations here as discussed above. The ISP gets WAN public IPs, creates its own small network LAN ( local area network ) which covers our home along with the neighbourhood. &lt;/p&gt;

&lt;p&gt;The ISP edge router ( WAN IP ) is the gateway to communicate with the external world. From the ISP edge router, they create a subnet for various routers, which includes our home. The router which is in our home creates its own network to manage all the devices that we connect. With this concept, we can connect many devices from a single WAN IP.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fav7lybykg22wippwv8p0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fav7lybykg22wippwv8p0.png" alt=" " width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our router in the home gets an IP from the ISP edge router. As we discussed above, the router in home which gives IP to each device we connect to it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5h8974klyz6wgimnwdxi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5h8974klyz6wgimnwdxi.png" alt=" " width="800" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In our above example, we can see a local network that connects many hosts ( devices). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CIDR NOTATION ( classless inter-domain routing)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's a modern way of representing IP. It purposefully avoids older class conventions of IP to avoid confusion, and it is no longer used.&lt;/p&gt;

&lt;p&gt;EXAMPLE : 198.162.30.3 / 24&lt;/p&gt;

&lt;p&gt;Here we have 32 bits IP; in this IP, 24 bits are dedicated to the network’s identification. We can observe that the first 3 parts were the same for all hosts, and the network ID of the network was 198.162.30.0.&lt;/p&gt;

&lt;p&gt;If we identified the network 198.162.30.0, we need to find the exact host next; here, the remaining 32 - 24 = 8 bits after the network ID is host ID, which points to the exact host in the network. So the host ID is 3 &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DEFAULT GATEWAY&lt;/strong&gt;&lt;br&gt;
The router is generally a gateway, which connects this host to external devices. Other hosts communicate to this router; the router communicates outside of the network on behalf of the other devices. It is common to dedicate the first IP of the network to the router: 198.162.30.1&lt;/p&gt;

&lt;p&gt;Number of networks vs. size of networks&lt;/p&gt;

&lt;p&gt;There are only 32 bits in IPV4; if we dedicate more bits,  we can create more labels. In our example, we dedicate 24 bits to the network ID ( label networks ). We can have  2 power 24  is 16,777,216 networks, but only 2 power 8, which is 256 devices, can be connected to each network.&lt;/p&gt;

&lt;p&gt;Similarly, if we create a network, network ID = 198.0.0.0 and &lt;br&gt;
host IP = 198.162.30.3 / 8&lt;/p&gt;

&lt;p&gt;We have only 256 networks, but for each network we can connect 16,777,216 devices.&lt;/p&gt;

&lt;p&gt;In the above paragraph, I mentioned the number of devices that can be connected to a network, but there are some special IDS which is reserved: the network ID and Broadcast ID. Broadcast ID will be discussed in future articles.&lt;/p&gt;

&lt;p&gt;The number of networks is inversely proportional to the size of each network.&lt;/p&gt;

&lt;p&gt;Let's discuss IPV6 to overcome the limitation of the 4 billion cap in IPV4. There are 8 groups of 16-bit numbers separated by  “:  “, and it is represented by hexadecimal numbers ( 0, 1, 2,.. 9, A, B, C, D, E, F).&lt;/p&gt;

&lt;p&gt;Example&lt;/p&gt;

&lt;p&gt;In CIDR Notation &lt;br&gt;
2001:0db8:85a3:0000:0000:0000:0000:0015/64&lt;/p&gt;

&lt;p&gt;Here in IPv6, the bits dedicated to representing the network ID are termed as Network prefix ( 2001:0db8:85a3:0000 ), and the host ID is termed as Interface ID ( 0000:0000:0000:0015 ). &lt;/p&gt;

&lt;p&gt;Going to explain networking from a common point of view; follow me if you want to stay up to date with my content. And also feel free to discuss concepts in comments, let we interact&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How Computers Talk to Each Other: A Beginner's Guide to IP, Ports, and Sockets</title>
      <dc:creator>vigneshgs271096</dc:creator>
      <pubDate>Tue, 11 Aug 2026 03:27:29 +0000</pubDate>
      <link>https://dev.to/vigneshgs271096/how-computers-talk-to-each-other-a-beginnersguide-to-ip-ports-and-sockets-2hfg</link>
      <guid>https://dev.to/vigneshgs271096/how-computers-talk-to-each-other-a-beginnersguide-to-ip-ports-and-sockets-2hfg</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv4qsoce0yh6xwt1z3dea.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv4qsoce0yh6xwt1z3dea.png" alt=" " width="800" height="655"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have you thought about how your phone talks to a website? Or how a computer knows where to send a message across the internet? &lt;br&gt;
In this article, we'll explore the hidden rules of the internet, and I'll explain concepts that make sense for absolute beginners.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem: How Devices Find Each Other among Billions of Devices?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine we want to send a letter to one person among billions of people in the world. You need two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;name (so you know who to contact)&lt;/li&gt;
&lt;li&gt;address (so the letter gets to the right place)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The internet needs similar unique identifications. When a process (a program that is currently running ) on our computer wants to talk to another process on another computer, it needs to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which machine it's trying to reach&lt;/li&gt;
&lt;li&gt;Which process on that machine it's trying to reach&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Meet the IP Address: Your Computer's Home Address&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of IP (Internet Protocol) as your computer's unique home address on the internet. Just like your physical address (123 Main Street) identifies where you live, an IP address identifies your computer on the network. &lt;/p&gt;

&lt;p&gt;For example, it might look like 192.168.1.1.&lt;br&gt;
But here's the thing: finding the right machine isn't enough. &lt;/p&gt;

&lt;p&gt;A single computer runs many programs (processes) at once. Your email app, web browser, and video player they're all running simultaneously. How does the internet know which program should receive the incoming message?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Meet the Port: Finding the Right Program&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is where port numbers come in.&lt;/p&gt;

&lt;p&gt;A port is a door number on a house, and our computer is the house (IP address).&lt;/p&gt;

&lt;p&gt;Each running program is a different room (port number). Each room has its own door number.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A web browser might be listening on port 80 for web pages&lt;/li&gt;
&lt;li&gt;Simultaneously, an email app might be listening on port 25 for incoming emails&lt;/li&gt;
&lt;li&gt;Simultaneously, a video game might be on port 5000&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When data arrives at our computer, the operating system (Windows, Mac, or Linux) reads the&lt;br&gt;
port number and delivers the message to the correct process (application/program currently running in the OS).&lt;/p&gt;

&lt;p&gt;So remember:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IP Address = Which computer on the internet?&lt;/li&gt;
&lt;li&gt;Port Number = Which running program on that computer?
Together, they form a complete address for the data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Client and Server: Who Talks to Whom?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Client: The One Who Asks&lt;/strong&gt;&lt;br&gt;
The client is the process that starts the conversation. It's like we're initiating an order to a restaurant.&lt;/p&gt;

&lt;p&gt;When we see a website in a browser, the browser ( representing us) is the client. It's requesting the server: "Hey server, can you send me the webpage?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Server: The One Who Listens.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The server is the process in the OS that waits for someone to talk to it. &lt;/p&gt;

&lt;p&gt;It's a restaurant receptionist waiting for customers.&lt;/p&gt;

&lt;p&gt;A server doesn't initiate conversations but listens on a specific port. When a client (a browser) requests information, the server responds to that client( browser ) or rejects the request.&lt;/p&gt;

&lt;p&gt;Here's the pattern:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Client: "Hello, I want some data"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Server: "Sure, here's the data asked for"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Client: "Thanks, received and goodbye"&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Sockets: The Operating System's Magic Tool&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Do you think like: "How does the operating system really manage all of this?"&lt;br&gt;
Yes—and it does it with something called a socket.&lt;/p&gt;

&lt;p&gt;A socket is the operating system's way of managing a network connection. Think of a socket like a special tool that hides all the messy details of how data actually travels across the internet.&lt;/p&gt;

&lt;p&gt;When an application wants to connect to another application, the OS creates a socket and assigns it a unique number called a file descriptor (label for sockets and files). This file descriptor lets the OS quickly locate your specific connection (the correct socket among many) when data arrives.&lt;/p&gt;

&lt;p&gt;Inside this socket, the OS stores everything needed for the conversation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Memory buffers (temporary storage for data coming in and going out)&lt;/li&gt;
&lt;li&gt;IP address (which computer)&lt;/li&gt;
&lt;li&gt;Port number (which program)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The brilliance of sockets is that the OS treats them almost exactly like files. Just as you can read from a file and write to a file, you can read data from a socket and write data to a socket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client Socket vs. Server Socket&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are two types of sockets, based on behavior:&lt;/p&gt;

&lt;p&gt;Client Socket:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Actively reaches out across the network&lt;/li&gt;
&lt;li&gt;Initiates the connection&lt;/li&gt;
&lt;li&gt;Sends requests and waits for responses&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Server Socket:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claims a specific port on its home machine&lt;/li&gt;
&lt;li&gt;Listens patiently for incoming connections&lt;/li&gt;
&lt;li&gt;Waits for clients to "knock on its door"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; A server doesn't need its own IP address. Multiple server programs can run on the same IP address because the operating system separates them using different port numbers. A single IP address for a machine, many organized by ports for different processes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Life of a Connection: Step by Step&lt;/strong&gt;&lt;br&gt;
Now let's see exactly what happens when a client and server connect. It's like a choreographed dance with specific moves.&lt;/p&gt;

&lt;p&gt;The Server's Setup (The Restaurant Preparing to Open)&lt;br&gt;
Before a server can accept any connections, it goes through these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create — The server asks the OS: "Create a new socket for me"&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The OS creates the socket and hands back a file descriptor&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bind — The server says: "Attach this socket to port 8080 on my IP address"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now the OS knows: "When data arrives for port 8080, deliver it to this socket"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Listen — The server tells the OS: "I'm ready for connections. Queue up to 100 clients waiting"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The OS prepares to accept incoming connections&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Accept — A client calls. The server accepts the connection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Here's the magic: The OS creates a brand new socket just for this conversation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The original socket keeps listening for more clients&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Receive/Send — The server listens to the client's request and sends back the response&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Client's Journey (The Customer Calling the Restaurant)&lt;br&gt;
Meanwhile, the client follows a simpler path:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create — The client asks the OS: "Create a socket for me"&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The OS creates it and assigns a file descriptor&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connect — The client says: "Connect me to IP address 192.168.1.1, port 8080"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The OS initiates a handshake (we'll skip the technical details, but it's like saying "Hello,&lt;br&gt;
are you there?")&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the server accepts, the connection is established&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Send/Receive — The client sends its request and waits for the response&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Handling Thousands of Customers at Once: The 4-Tuple Magic&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's a question that might seem confusing: if a thousand customers connect to the same restaurant on the same port, how does the server keep them separate?&lt;/p&gt;

&lt;p&gt;The answer is hidden in something called the TCP 4-Tuple.&lt;/p&gt;

&lt;p&gt;The Problem&lt;br&gt;
When the server accepts a client connection, it creates a new socket for that conversation. But this new socket uses the same port as the original listening socket. If port 443 is the "front door" of a web server, all thousand customer conversations still go through that same door.&lt;/p&gt;

&lt;p&gt;How does the OS prevent chaos?&lt;/p&gt;

&lt;p&gt;The Solution: Four Pieces of Information&lt;br&gt;
The operating system doesn't identify a connection based on the port alone. Instead, it uses four pieces of information:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Client IP Address (e.g., 192.168.50.5)&lt;/li&gt;
&lt;li&gt;Client Port Number (e.g., 51234)&lt;/li&gt;
&lt;li&gt;Server IP Address (e.g., 192.168.1.1)&lt;/li&gt;
&lt;li&gt;Server Port Number (e.g., 443)
This combination of four numbers is called the 4-Tuple, and it's always unique for every connection.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here's why: Even if a thousand users connect to your server on the same IP and port, each user's computer has a different IP and is assigned a different port number for each client socket. So:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User 1: (192.168.50.5, 51234, 192.168.1.1, 443)&lt;/li&gt;
&lt;li&gt;User 2: (192.168.50.6, 51235, 192.168.1.1, 443)&lt;/li&gt;
&lt;li&gt;User 3: (192.168.50.7, 51236, 192.168.1.1, 443)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every 4-Tuple is unique. When data arrives, the OS looks at all four numbers, finds the&lt;br&gt;
matching socket, and delivers the data to the correct conversation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Restaurant Analogy&lt;/strong&gt;&lt;br&gt;
The main listening socket is a receptionist standing at the restaurant's front door. The receptionist's job is to watch for new arrivals.&lt;/p&gt;

&lt;p&gt;When a customer walks in (client socket's request), the receptionist greets (accepts the client socket request) and immediately assigns you a dedicated waiter (a new child socket). That waiter is now exclusively assigned to you, even though the waiter works at the same restaurant address as the receptionist.&lt;/p&gt;

&lt;p&gt;You and your waiter communicate directly while the receptionist turns back to the front door to greet the next customer. Thanks to your unique combination of information (your face, your table number, your arrival time, etc is the 4-tuple), the kitchen never mixes up your order with anyone else's.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Making Multiple Requests: Smart Reuse&lt;/strong&gt;&lt;br&gt;
Here's another practical question: if I want to view 50 different things on the same website, do I need to open 50 different connections?&lt;/p&gt;

&lt;p&gt;The short answer: No.&lt;/p&gt;

&lt;p&gt;Opening and closing network connections is slow and expensive. Instead, modern applications use a feature called Keep-Alive to reuse a single socket connection for multiple requests.&lt;/p&gt;

&lt;p&gt;So your browser might:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Load the webpage (Request 1)&lt;/li&gt;
&lt;li&gt;Load an image (Request 2)&lt;/li&gt;
&lt;li&gt;Load a stylesheet (Request 3)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All through the same single socket connection, one after another. The server doesn't close the connection; it just waits for the next request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Blindness of Sockets&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But here's something important to understand:&lt;/strong&gt; &lt;br&gt;
The socket itself has no idea what an "API call" or "request" is.&lt;br&gt;
To the operating system, a socket is just a dumb pipe. Data goes in one end, comes out the other. The OS doesn't care about organizing messages or separating API requests(The images, website HTML, and other resource requests are different API requests). It just moves bytes.&lt;/p&gt;

&lt;p&gt;So if you send 50 requests through one socket, how does the server know where one request ends and another begins?&lt;br&gt;
Who Keeps the Conversations Straight?&lt;/p&gt;

&lt;p&gt;The answer is: the application layer (protocols like HTTP).&lt;/p&gt;

&lt;p&gt;When your browser sends multiple requests through a single socket, it attaches a unique identifier—called a stream ID—to each piece of data.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your browser sends: "Get me the profile" (tagged as Request #1)&lt;/li&gt;
&lt;li&gt;Your browser sends: "Get me the profile picture" (tagged as Request #2)
Both travel through the same socket to the server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the server sends responses back, it includes those same tags:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Response to Request #1: "Here's your profile" (tagged as #1)&lt;/li&gt;
&lt;li&gt;Response to Request #2: "Here's your profile picture" (tagged as #2)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your browser reads the incoming stream, examines the tags, and routes each response to the appropriate place in your software.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Waiter and the Kitchen Tickets&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Back to our restaurant analogy: Imagine your dedicated waiter is the physical pipe (the socket).&lt;/p&gt;

&lt;p&gt;If a customer orders an appetizer, a main course, and dessert, he doesn't need three different waiters.&lt;/p&gt;

&lt;p&gt;One waiter carries all his orders back and forth. How does the kitchen avoid mixing up different customers' dishes?&lt;/p&gt;

&lt;p&gt;The waiter writes a unique ticket number on every order slip (stream ID). The waiter doesn't care about the numbers; they just carry the paper.&lt;/p&gt;

&lt;p&gt;But the kitchen staff (the application layer) reads&lt;br&gt;
the numbers to make sure the right food reaches the right table.&lt;/p&gt;

&lt;p&gt;Putting It All Together&lt;br&gt;
Let's trace the complete journey of a simple action: you opening a website in your browser.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Your browser (client) creates a socket&lt;/li&gt;
&lt;li&gt;Your browser asks the OS: "Connect me to google.com (the server) on port 443"&lt;/li&gt;
&lt;li&gt;Google's server has been sitting and listening on port 443 with its own socket&lt;/li&gt;
&lt;li&gt;Google's server accepts your connection and creates a new socket just for you&lt;/li&gt;
&lt;li&gt;The OS uses the 4-Tuple (your-ip, your-port, google-ip, 443) to remember this conversation&lt;/li&gt;
&lt;li&gt;Your browser sends a request: "Send me the homepage"&lt;/li&gt;
&lt;li&gt;Google's server sends back the webpage data&lt;/li&gt;
&lt;li&gt;Your browser displays the page&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All of this happens in milliseconds, and the OS manages thousands or millions of simultaneous connections.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The internet's foundation is built on a few simple ideas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IP addresses find the right computer&lt;/li&gt;
&lt;li&gt;Port numbers find the right program on that computer&lt;/li&gt;
&lt;li&gt;Sockets are the OS's way of managing these connections&lt;/li&gt;
&lt;li&gt;The 4-Tuple keeps thousands of conversations from getting mixed up between two processes on the internet&lt;/li&gt;
&lt;li&gt;The application layer handles the higher-level logic of requests and responses from the same processes but different reasons.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm going to add engineering content in simple words like this. To see more like this, please follow me on dev. to.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/vigneshgs271096/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/vigneshgs271096/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Did this help clarify how the internet works? Share your thoughts in the comments!&lt;/p&gt;

</description>
      <category>api</category>
      <category>crawler</category>
      <category>webdev</category>
      <category>computernetwork</category>
    </item>
  </channel>
</rss>
