Socket in Computer Network (original) (raw)

Last Updated : 14 May, 2025

A **socket is one endpoint of a two way communication link between two programs running on the network. The socket mechanism provides a means of inter-process communication (IPC) by establishing named contact points between which the communication take place.

Socket-in-Computer-Network-1

How Sockets Work in Computer Networks

Like 'Pipe' is used to create pipes and sockets is created using 'socket' system call. The socket provides bidirectional FIFO Communication facility over the network.

Socket-in-Computer-Network-2

**Types of Sockets

There are two types of Sockets:

Common Function Calls in Socket Programming

Here is a summary of the common function calls used in socket programming:

Function Call Description
Socket() To create a socket
Bind() It's a socket identification like a telephone number to contact
Listen() Ready to receive a connection
Connect() Ready to act as a sender
Accept() Confirmation, it is like accepting to receive a call from a sender
Write() To send data
Read() To receive data
Close() To close a connection