Page 1 of 6
Home Whiteboard Online Compilers Practice Articles Tools
Chapters Categories
Socket in Computer Network
Network Socket
A network socket is a software component within a computer network node that acts as
an endpoint for delivering and receiving data. An application programming interface (API)
for the networking architecture defines the structure and properties of a socket. Sockets
are only produced over the lifespan of a process in a node-based application.
Because the TCP/IP protocols were standardized during the creation of the Internet, the
word "network socket" is most often used in the context of the Internet Protocol suite,
and it is hence referred to as an "Internet Socket". In this context, a socket's address,
which is the triad of the transport protocol, IP address, and port number, is used to
externally identify it to other hosts.
The software endpoint of node-internal inter-process communication (IPC), which
frequently utilizes the same API as a network socket, is often referred to as a socket.
Pipes are formed using the 'Pipe' system call, and sockets are generated with the 'socket'
system call. Over the network, the socket allows bidirectional FIFO communication. At
either end of the connection, a socket connecting to the network is formed. Each socket
has its unique address. An IP address plus a port number make up this address.
In most client-server applications, sockets are used. The server builds a socket, connects
it to a network port, and waits for the client to connect to it. After creating a socket, the
client tries to connect to the server socket. Data is transferred after the link is established.
Advertisement
[Link] w w .[Link]/data_communication_computer_netw ork/computer_netw ork_socket.htm 1/6
Page 2 of 6
Types of Sockets
1. Datagram Socket
A datagram socket is a type of network socket in which packets are sent and received
without the use of a link. It resembles a mailbox. Letters (data) are gathered and delivered
(transmitted) to a mailbox (receiving socket). It is a connection-less socket.
2. Stream Socket
A stream socket is a type of network socket in a computer operating system that
provides a connection-oriented, sequenced, and unique flow of data without record
boundaries, as well as well-defined mechanisms for creating and destroying connections
and detecting errors. It is comparable to a telephone. Between the phones (two ends), a
link is created.
Network Socket Client Server Interaction
The following diagram shows the complete Client and Server interaction
[Link] w w .[Link]/data_communication_computer_netw ork/computer_netw ork_socket.htm 2/6
Page 3 of 6
Function Call Description
create() To construct a socket
bind() It's a socket identifier, similar to a phone number for contacting someone.
connect() Are you ready to make a connection?
listen() Prepared to send a message
accept() Confirmation is similar to accepting a call from a sender.
write() To send data
[Link] w w .[Link]/data_communication_computer_netw ork/computer_netw ork_socket.htm 3/6
Page 4 of 6
Function Call Description
read() To receive data
close() To make a relationship permanent
TOP TUTORIALS
Python Tutorial
Java Tutorial
C++ Tutorial
C Programming Tutorial
C# Tutorial
PHP Tutorial
R Tutorial
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
SQL Tutorial
TRENDING TECHNOLOGIES
Cloud Computing Tutorial
Amazon Web Services Tutorial
Microsoft Azure Tutorial
Git Tutorial
Ethical Hacking Tutorial
Docker Tutorial
Kubernetes Tutorial
DSA Tutorial
Spring Boot Tutorial
SDLC Tutorial
Unix Tutorial
CERTIFICATIONS
Business Analytics Certification
[Link] w w .[Link]/data_communication_computer_netw ork/computer_netw ork_socket.htm 4/6
Page 5 of 6
Java & Spring Boot Advanced Certification
Data Science Advanced Certification
Cloud Computing And DevOps
Advanced Certification In Business Analytics
Artificial Intelligence And Machine Learning
DevOps Certification
Game Development Certification
Front-End Developer Certification
AWS Certification Training
Python Programming Certification
COMPILERS & EDITORS
Online Java Compiler
Online Python Compiler
Online Go Compiler
Online C Compiler
Online C++ Compiler
Online C# Compiler
Online PHP Compiler
Online MATLAB Compiler
Online Bash Terminal
Online SQL Compiler
Online Html Editor
ABOUT US | OUR TEAM | CAREERS | JOBS | CONTACT US | TERMS OF USE |
PRIVACY POLICY | REFUND POLICY | COOKIES POLICY | FAQ'S
[Link] w w .[Link]/data_communication_computer_netw ork/computer_netw ork_socket.htm 5/6
Page 6 of 6
Tutorials Point is a leading Ed Tech company striving to provide the best learning material on
technical and non-technical subjects.
© Copyright 2025. All Rights Reserved.
[Link] w w .[Link]/data_communication_computer_netw ork/computer_netw ork_socket.htm 6/6