The Magic of Instant Messaging: How Messages Are Sent and Received

Charles Lo
5 min readFeb 16, 2023

--

Image source — https://images.ctfassets.net/lzny33ho1g45/1leMJIY3vYoe3zgr3L7LhT/25293610905ee95bee800ea99278ceb9/chat_apps.png

In today’s world, communication and collaboration are more important than ever. Thanks to the plethora of digital tools available, we can now easily communicate with others from around the world in real-time. Whether it’s through instant messaging apps, email, video conferencing, or other communication tools, we can stay connected to our colleagues, friends, and family regardless of their location.

But have you ever wondered how these messages are actually sent and received? How does a message sent from your computer, smartphone, or other device reach its destination in a matter of seconds? It may seem like magic, but the reality is that there is a complex system behind the scenes that makes it all possible.

First, let’s look at how messages are sent. When you hit send on your device, your message is first broken down into packets of data. These packets are then transmitted across the internet, hopping from one device to another until they reach their destination. The process is similar to sending a letter through the mail — the message is broken down into smaller units (envelopes) that are sent from one location to the next until they reach the recipient.

To send the packets, your device needs to know the IP address of the recipient’s device. An IP address is a unique identifier assigned to each device connected to the internet. When you send a message, your device communicates with a Domain Name System (DNS) server to convert the domain name (e.g. www.example.com) into the corresponding IP address. This enables your device to send the packets to the correct location.

When a message is sent, it is transmitted using the TCP protocol, which ensures that the packets are sent in the correct order and that any missing packets are re-sent. The recipient’s device uses the IP protocol to receive the packets and reassemble them into the original message. Once the message has been reassembled, it is passed to the relevant application (e.g. an instant messaging app) for the user to view.

Image source — https://cdn.kastatic.org/ka-perseus-images/e5fdf560fdb40a1c0b3c3ce96f570e5f00fff161.svg

In summary, sending and receiving messages may seem like magic, but it is actually a complex process involving many different systems working together. Without these systems, we wouldn’t be able to enjoy the instant communication that we take for granted today. So next time you send a message to a colleague, friend, or family member, take a moment to appreciate the incredible technology that makes it all possible.

Example scenario: Imagine you’re working remotely with a colleague on an urgent project. You need to send a message with some important information, but your colleague is in a different time zone. You compose the message on your computer and hit send. The message is broken down into packets of data and transmitted across the internet to your colleague’s device, where it is reassembled and displayed in their instant messaging app. They are able to respond to your message immediately, and the project can move forward smoothly thanks to the power of modern communication technology.

Still not getting it yet? Let’s put it in order :D

Let’s say you want to send a message from your computer to a friend’s computer. Here’s how it might work using the TCP/IP protocol:

  1. Your message is broken down into smaller “packets” of data. Each packet contains a piece of your message, as well as information about the sender (you) and the recipient (your friend).
  2. Each packet is given a unique number (called a “sequence number”) so that it can be reassembled in the correct order on the receiving end.
  3. The packets are sent across the internet via different network routers and switches until they reach your friend’s computer.
  4. When the packets arrive at your friend’s computer, they are reassembled in the correct order using the sequence numbers.
  5. Your friend’s computer then sends an acknowledgement message back to your computer to confirm that it has received the message.
  6. If any packets were lost or damaged during transmission, your friend’s computer will request that they be re-sent.

This process is repeated for every message that is sent over the internet using the TCP/IP protocol. It allows messages to be broken down into smaller, more manageable pieces and sent over a network in a reliable and efficient way.

More topics you maybe instead on

About the Author

Hi Medium Community, my name is Charles Lo and I’m currently a project manager and data manager at Luxoft. Luxoft is a place where we combine a unique blend of engineering excellence and deep industry expertise to serve clients globally, specializing in cross-industry including but not limited to automotive, financial services, travel and hospitality, healthcare, life sciences, media, and telecommunications. In addition, Luxoft is also a family member of DXC.

I’m passionate about technology and hold several certifications including Offensive Security Certified Professional, AWS Certified Solution Architect, Red Hat Certified Engineer, and PMP Project Management. I have years of experience working in the banking, automotive, and open-source industries and have gained a wealth of knowledge throughout my career.

As I continue on my Medium journey, I hope to share my experiences and help others grow in their respective fields. Whether it’s providing tips for project management, insights into data analytics, or sharing my passion for open-source technology, I look forward to contributing to the Medium community and helping others succeed.

Author Linkedinhttps://www.linkedin.com/in/charlesarea/

--

--

Charles Lo

⭐ Tech pro passionate about cloud computing, security, programming, open-source, and project management. Sharing expert insights to drive innovation and growth