What is a network socket or net socket?

Map Of Internet 1973


A Network socket or net socket is a socket for the Internet protocol suite (TCP and UPD) that creates a network connection to or from which information is transmitted in the network between a server (local machine) and a client (remote machine).

It's also known more commonly as the endpoint as this is where the service will bind to be able to listen and answer their clients.

This connection is implemented by software (not hardware) by creating a network interface.

Today, most communication between computers is based on the Internet Protocol; therefore most network sockets are TCP sockets.

Socket communications are nowadays bidirectional (full duplex) (With Tcp sure, udp ???)


A net socket on an operating system level is characterized by a unique combination of the following:

The output of netstat showing a socket Id with its state. They are all TCP socket

Netstat Windows


A socket address is the combination of


The type of socket is defined by the protocol that implements it. (ie a TCP socket is a socket implemented by TCP)

There are several Internet socket types available:

  • Datagram sockets, also known as connectionless sockets
  • Stream sockets, also known as connection-oriented sockets, which use Transmission Control Protocol (TCP) or Stream Control Transmission Protocol (SCTP).
  • Raw sockets (or Raw IP sockets), typically available in routers and other network equipment. Here the transport layer is bypassed, and the packet headers are made accessible to the application.


Socket lifecycle.

A state is an information that is given for a protocol that supports a connection. It means that this is often about a TCP socket because UDP is connection less


  • Listening: Computer processes that provide application services are called as servers, and create sockets on start up that are in listening state. These sockets are waiting for initiatives from client programs. See TCP Listening state


The operating system forwards the payload of incoming IP packets to the corresponding application by extracting the socket address information from the IP and transport protocol headers and stripping the headers from the application data.



The output of netstat showing a socket Id with its state

Netstat Windows


  • Number of open sockets with netstat
netstat | grep port



Netcat can be used to send data over socket.



SocketAddress bindAddress = SocketAddress.inetSocketAddress(4043, "localhost");

For IPC, you could also use ObjectOutputStream and ObjectInputStream connected to network sockets and exchange Java objects directly between the two programs. Or you could design your own protocol.

1) 2) 3)

original definition of socket given in RFC 147, as it was related to the ARPA network in 1971

Discover More
Map Of Internet 1973
Network - (Internet) Socket (Network identifier)

A socket is a session identifier for a connection between 2 processes via a particular protocol. It's also known as a IPC socket. List of sockets and their transport protocols: netsocket: The net...
What is a Port in computing?

This article is about the network port, what it is, how we use it and more
Process States
What is a Service?

A service is a process that: runs continuously in the background are started by the operating system when the system starts. It's declared and managed by the OS init system. With the init system,...

Share this page:
Follow us:
Task Runner