Questions tagged [unix-socket]

UNIX domain sockets are a technology for interprocess communication on a single computer.

UNIX domain sockets are a technology for interprocess communication on a single computer. They allow processes on the same machine to establish bidirectional connections to exchange either continuous byte streams or datagram messages.

The API is in many places the same as the one used for TCP/IP network sockets. A UNIX domain socket listening for connections may be represented as an inode in the file system, depending on the operating system and the parameters used to bind that socket.

Unix Domain Sockets can only communicate within a Linux OS kernel, they can not communicate externally to a kernel.

Details are provided in the unix(7) man page.

699 questions
22
votes
6 answers

How can I delete a UNIX Domain Socket file when I exit my application?

I have a server application that creates a UNIX Domain Socket in a specific path with a name and bind()s to it. I need to delete the socket only when I close/stop the application intentionally, from within the the application code; otherwise it…
Pheonix7
  • 2,131
  • 5
  • 21
  • 38
22
votes
1 answer

How to view and edit the ephemeral port range on Linux?

In my Linux system ephemeral port range is showing different ranges as follows $ cat /proc/sys/net/ipv4/ip_local_port_range 32768 61000  cat /etc/sysctl.conf | grep net.ipv4.ip_local_port_range net.ipv4.ip_local_port_range = 9000…
Steephen
  • 14,645
  • 7
  • 40
  • 47
20
votes
3 answers

How to access Unix Domain Sockets from the command line?

Reading a Unix Domain Socket file using Python is similar to an ordinary TCP socket: >>> import socket >>> import sys >>> >>> server_address = '/tmp/tbsocket1' # Analogous to TCP (address, port) pair >>> sock = socket.socket(socket.AF_UNIX,…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
19
votes
4 answers

UNIX Domain Socket in Java

I see these threads UNIX socket implementation for Java? and http://forums.sun.com/thread.jspa?threadID=713266. The second link says that Java already supports UNIX Domain Socket. If that's true what class do I need to implement from Java?. From…
korrawit
  • 1,000
  • 2
  • 18
  • 30
19
votes
2 answers

bind(): No such file or directory [core/socket.c line 230]

I'm trying to create a unix socket application for a run in uWSGI... but does not allow me to create the socket, please check the following settings. [uwsgi] chdir = /home/deploy/webapps/domain/virtualenv/app module =…
Colpaisa
  • 355
  • 1
  • 4
  • 14
19
votes
5 answers

Gracefully shutdown UNIX-socket server on NodeJS running under Forever

I have an NodeJS application which sets up a UNIX-socket to expose some interprocess communication channel (some kind of monitoring stuff). UNIX-socket file is placed in os.tmpdir() folder (i.e. /tmp/app-monitor.sock). var net = require('net'); var…
Olegas
  • 10,349
  • 8
  • 51
  • 72
18
votes
4 answers

Permission denied while trying to connect to the Docker daemon socket

On Ubuntu 16.04 LTS whenever trying using docker login command the following warring message will be show : docker login Warning: failed to get default registry endpoint from daemon (Got permission denied while trying to connect to the Docker…
Chandru
  • 10,864
  • 6
  • 38
  • 53
18
votes
2 answers

Why is the maximal path length allowed for unix-sockets on linux 108?

When creating a unix socket, the path name (man 7 unix) is allowed to be maximally 108 chars long. For a friend this caused a bug in his program because his path was longer. Now we wonder how exactly that number was determined. I have the suspicion…
Johannes Schaub - litb
  • 496,577
  • 130
  • 894
  • 1,212
18
votes
2 answers

Identify other end of a unix domain socket connection

I'm trying to figure out what process is holding the other end of a unix domain socket. In some strace output I've identified a given file descriptor which is involved in the problem I'm currently debugging, and I'd like to know which process is on…
MvG
  • 57,380
  • 22
  • 148
  • 276
17
votes
3 answers

Identify program that connects to a Unix Domain Socket

I have a program that is listening to a Unix Domain Socket. When a client connects to the socket I'd like to find out which program connected and then decide if I allow the connection or not (based on the user/group settings). Is this possible under…
Nils Pipenbrinck
  • 83,631
  • 31
  • 151
  • 221
17
votes
1 answer

Unix Sockets : AF_LOCAL vs AF_INET

I'm just starting with socket programming in UNIX and I was reading the man pages for the socket system call. I'm a bit confused about the AF_LOCAL argument and when it is used. The manual just says local communication. Wouldn't an AF_INET format…
npn
  • 381
  • 1
  • 5
  • 14
16
votes
3 answers

Read and write from Unix socket connection with Python

I'm experimenting with Unix sockets using Python. I want to create a server that creates and binds to a socket, awaits for commands and sends a response. The client would connect to the socket, send one command, print the response and close the…
aleknaui
  • 409
  • 1
  • 5
  • 11
16
votes
4 answers

Reading a file in real-time using Node.js

I need to work out the best way to read data that is being written to a file, using node.js, in real time. Trouble is, Node is a fast moving ship which makes finding the best method for addressing a problem difficult. What I Want To Do I have a java…
Oliver Lloyd
  • 4,936
  • 7
  • 33
  • 55
15
votes
1 answer

Principle of Unix Domain Socket. How does it work?

I am doing a study about Unix domain socket. Especially about how does it work. I googled many times with many keywords but the results are all about API, system calls, how to use it, examples ... . I have read about Pipe and FIFO too because Unix…
leokaka
  • 151
  • 1
  • 1
  • 6
14
votes
3 answers

What mechanism is used by MSYS/Cygwin to emulate Unix domain sockets?

I'm attempting to write (in C#) a piece of software that communicates with another piece of software, built with MSYS, over (MSYS emulated) Unix domain sockets. I've learned that the "socket server" (I'm not clear on what the proper terminology is)…
Mark
  • 11,257
  • 11
  • 61
  • 97
1
2
3
46 47