What is an Unix Domain Socket (IPC socket)?

Map Of Internet 1973

About

An Unix domain socket is a socket implementation used for internal inter-process communication where 2 processes executing on the same host operating system can exchange data.

Because it's used for IPC, it's also known as IPC socket

Management

Set

For a UNIX domain socket, you must:

  • pick a location within your filesystem that the process will be able to access in which the socket will be created where another internal process would be able to connect,
  • set file permissions accordingly.

List

With netstat and the -x option of the socket argument

netstat -all -p -x
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name     Path
unix  2      [ ]         DGRAM                    11270    1/systemd            /run/systemd/shutdownd
unix  2      [ ]         DGRAM                    13344    505/chronyd          /var/run/chrony/chronyd.sock
unix  2      [ ACC ]     STREAM     LISTENING     10585962 30548/master         private/rewrite
unix  2      [ ACC ]     STREAM     LISTENING     12884387 22550/netdata        /tmp/netdata-ipc
unix  2      [ ACC ]     STREAM     LISTENING     10585948 21578/pickup         public/pickup
unix  2      [ ACC ]     STREAM     LISTENING     9057     1/systemd            /run/systemd/private
unix  2      [ ACC ]     STREAM     LISTENING     14946    534/NetworkManager   /var/run/NetworkManager/private-dhcp
unix  2      [ ACC ]     STREAM     LISTENING     10585952 30548/master         public/cleanup
unix  2      [ ACC ]     STREAM     LISTENING     10585965 30548/master         private/bounce
........................

Share / Proxy

A UNIX domain socket can be secured using the filesystem (i.e., with user or group permissions), but cannot be reached from other machines that might want to share the service.

You need to use a proxy:

Language

Java

The most known library is junixsocket

File socketFile = new File("/path/to/your/socket");
// For docker: File socketFile = new File("/var/run/docker.sock");
AFUNIXSocket sock = AFUNIXSocket.newInstance();
sock.connect(AFUNIXSocketAddress.of(socketFile));

Documentation / Reference





Discover More
Docker Daemon
Docker - Daemon - dockerd

The Docker daemon (dockerd) is the hypervisor background process that the docker cli command is calling under the hood. It's a runtime for containers. a background service running on the host that...
Dkim Record Text Format Ovh Dns Zone
How to configure DKIM with PostFix, a step by step guide

This article will show and explain you how to install DKIM with OpenDkim as a milter for Postix on CentOS
Map Of Internet 1973
Network File

Network file: Internet socket, NFS file or UNIX domain socket with lsof: to list only network files with TCP state LISTEN, use: to list network files with all UDP states except Idle,...
Git Open Ssh
What is OpenSSH ssh-agent?

ssh-agent is the authentication agent of Openssh. It stores un/desencrypted private keys in memory, and communicates with SSH clients via Unix_domain_socket you don't get a ssh-agent Unix Socket...
Windows Network Protocol Sysinfo
What is a Network Communication Protocol?

A network protocol is a protocol: that describes the computer language that will allow two or more computer processes to communicate together. agentsAlgorithms A protocol has only one OSI level...
Map Of Internet 1973
What is a socket? known also endpoint

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...
Map Of Internet 1973
Windows Named Pipe

A windows named pipe is the IPC socket implementation of Windows. It's the counter part of the Unix Socket. On Docker, it works only with windows container.



Share this page:
Follow us:
Task Runner