DEV Community

vkopmp07
vkopmp07

Posted on

What are sockets in computer networks?

Two processes that run on the same machine, or different machines, communicate through sockets. Sockets are seen as the end of the two-way communication between two processes; they allow processes to communicate with each other ​using a file descriptor and are commonly used in client-server applications that allow ​for ​communication between multiple applications.

How sockets are created

A socket is created by concatenating the IP number of a system and a software port number (not a ​hardware port number). This allows the process to know the address of the system (the IP address) and the address where the information needs to be sent (the port number). The IP number and the port number are separated by a ​:.
Alt Text
The diagram above shows two different applications communicating with one another through sockets.

In this diagram, application 1 sends the data to IP number 192.168.16.21 of application 2, port 100, while application 2 sends the data to ​IP number 192.168.1.1 of application 1, port ​80.

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay