Introduction of Socket

  • The concept of Socket begins with the ARPANET since 1971.
  • The term network socket is most commonly used in the context of the Internet protocol suite, and is therefore often also called Internet socket.
  • The term network socket is analogous to electrical device’s female connector.
  • The concept of socket is described by the transport layer of the TCP/IP protocol suite or Session layer of the OSI model

Definition of Socket

  • Socket is an identifier/logical structure to establish a connection between two end machines in a computer network, for complete communication.
  • A network socket is a software structure within a network node(Client and Server or host machine) of a computer network that serves as an endpoint for sending and receiving data across the network. 
  • socket is an endpoint of a two-way communication link between two programs running on the network.

Characteristics/Features of Socket

  • Socket is responsible for process-to-process delivery of messages in a network between sender and receiver.
  • A socket is bound to a unique port number so that the TCP/IP protocol suites can identify the diffrent applications data is destined to be sent to.
  • Network sockets dedicates the persistent connections for communication between two nodes in a network.
  • Sockets are created only during the lifetime of a process of an application running in the node.
  • In the client server model, a pair of socket is required for complete communication i.e. one for the client (client IP address & client port number) and another for the server (server IP address & server port number).
  • The structure and properties of a socket are defined by an application programming interface(API) for the networking architecture.

Structure of Socket

  • A socket is externally identified to other hosts by its socket address, which is actually created with the API as the triad combination of transport layer protocol(TCP or UDP, used for transmissions)IP or network address of the host machine, and Port number/address of the process running on it. 
  • For example, Suppose an IP address of the machine is and a process running on it is assigned a port number of 2231, then the socket contains (, 2231). Thus, a socket uniquely identifies the process from the set of processes running on this machine.
  • The combination of client or local socket and remote socket are called socket pairs. Each socket pair is described by a unique 4-tuple consisting of protocols, source and destination IP addresses and port numbers

Types of Socket

There are following types of Socket exists in a network environment- 

(A) On the basis of use of protocols in socket during communication, they are categorised into two parts –

(a) Datagram Socket :

      • This socket uses UDP protocol during communication which is actually a connectionless method of transmission hence it is also called Connectionless socket/UDP Socket. 
      • In datagram socket, each data packet sent or received is individually addressed and routed. The communication order and reliability are not guaranteed, so multiple data packets sent from one machine or process to another may arrive in any order or might not arrive at all.
      • In  this socket, special configuration may be required to send data as broadcast way. In order to receive broadcast packets, a datagram socket may or may not be bound to a specific address due to connectionless feature.
      • UDP sockets are not identified by the remote address, but only by the local address, although each message has an associated remote address that can be retrieved from each datagram with the networking application programming interface (API).
      • Unlike TCP socket, UDP sockets do not have an established state, because it uses connectionless protocol.

(b) Stream Socket :

      • This socket uses TCP protocol during communication which is actually a connection oriented method of transmission hence it is also called Connection Oriented socket/TCP Socket. 
      • A stream socket provides a sequenced and unique flow of error-free data without record boundaries, with well-defined mechanisms for creating and destroying connections and reporting errors.
      • A stream socket transmits data reliably, in order, and with out-of-band capabilities.


(a) Raw Socket

      • Raw sockets allow direct sending and receiving of IP packets without any protocol-specific transport layer formatting.
      • Raw sockets are typically available in network equipment and are used for routing protocols such as IGRP and OSPF, and in ICMP.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.