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
8
votes
2 answers

Unix Domain Sockets: accept() not setting sun_path

I am doing some testing with Unix domain sockets and I can communicate over them without an issue, however, when I call accept() on the server side of my test program, the returned struct sockaddr_un doesn't contain a sun_path. I am pretty sure that…
Kevin S
  • 2,713
  • 24
  • 31
8
votes
2 answers

Wait for a Unix Domain socket to be bound

I am writing a client app which connects to a server process through a Unix domain socket. If the server process is not running, I want the client to wait until the server has started and is listening for connections on the socket. Currently I have…
James
  • 3,597
  • 2
  • 39
  • 38
7
votes
4 answers

Using Java NIO with Unix Domain sockets in non-blocking mode with selectors

Is there a way to use Unix Domain sockets with Java NIO? I want to use NIO so that I can use Selectors on it in a single thread. I had a look at junixsocket but it only seems to support normal Sockets not NIO channels that support selectors.
jbx
  • 21,365
  • 18
  • 90
  • 144
7
votes
2 answers

Connect Node.js as client to a Common Lisp server

I've got small but CPU heavy app in alpha stage in node.js, it's a small game. I'm running into performance issues and I need to speed it up by at least a factor of 20 to get to beta. And since parallel execution would get me very far, I decided…
enrey
  • 1,621
  • 1
  • 15
  • 29
7
votes
1 answer

Socket Programming: UDP Client-Server in C

I'm trying to write a client server program using UDP, and wait-and-stop, but I haven't got to that part, I'm still trying to figure it out how the two processes (server and client) communicate, because on my client program, the user needs to enter…
William Studart
  • 321
  • 1
  • 3
  • 12
7
votes
1 answer

UNIX socket connection refused

Under OS-X, I've got process named 'listener' that is waiting on 'accept' to read data from local unix socket named listener_socket. unfortunately, any attempt to connect that socket terminate in 'connection refused' error. Using lsof, to make sure…
Zohar81
  • 4,554
  • 5
  • 29
  • 82
7
votes
1 answer

How can one connect to a Unix socket using akka?

While it is relatively easy to connect to an java.net.InetSocketAddress using TCP or UDP in akka, there seems to be no equivalent for SocketAddress and Unix-sockets in the API. For my current project i need to connnect to the Docker Remote-API using…
Richard
  • 1,117
  • 11
  • 31
7
votes
1 answer

C unix domain sockets, recvfrom() doesn't set struct sockaddr* src_addr

I'm writing an application that listens for UDP packets over a unix domain socket. Consider the following code block. int sockfd; struct sockaddr_un servaddr; sockfd = socket(AF_LOCAL, SOCK_DGRAM, 0); if(sockfd < 0) { perror("socket()…
user2278457
  • 315
  • 2
  • 9
7
votes
1 answer

psql can connect to a unix domain socket, but py-postgresql with the same parameters gets 'Permission denied'

Problem description: My system user is milosz, which is mapped to the PostgreSQL user project_great in pg_ident.conf. I am using peer authentication to connect to a PostgreSQL database over a unix domain socket. This connection method works when…
Milosz
  • 2,924
  • 3
  • 22
  • 24
7
votes
0 answers

Using UNIX sockets for jenkins?

Some refs: Java UNIX domain sockets (JUDS) - https://github.com/mcfunley/juds Java/JNI for unix domain sockets - https://code.google.com/p/junixsocket/ Context: I want to use UNIX sockets for my Jenkins server I have an nginx setup with an…
dnozay
  • 23,846
  • 6
  • 82
  • 104
7
votes
2 answers

UNIX sockets: Is it possible to spoof getsockopt() SO_PEERCRED?

Is there a (compatible) way to spoof (as root) the unix socket (file system sockets) peer credentials which can be obtained by getsockopt(), option SO_PEERCRED? Background: I need to connect to a server application (which I cannot modify) which…
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
7
votes
3 answers

Force MySQL to use only unix socket

I want my MySQL server to only use unix socket, and ignore the TCP networking, so I added this line to my configuration /etc/my.cnf: skip-networking But netstat show me that MySQL still using TCP port 3306: # netstat -tl | grep mys tcp 0 …
SIFE
  • 5,567
  • 7
  • 32
  • 46
6
votes
2 answers

What is the result of mounting `/var/run/docker.sock` in a Docker in Docker scenario?

I've read Can anyone explain docker.sock to understand what /var/run/docker.sock does, but its use in GitLab CI's Use Docker socket binding has me confused. Here is their example command for the gitlab-runner registration: sudo gitlab-runner…
6
votes
1 answer

Using UNIX sockets with Dart

Currently I can use a TCP socket : final socket = await Socket.connect('127.0.0.1', 8888); I would like to use a UNIX socket. Is there a way to do this with Dart ?
Augustin R
  • 7,089
  • 3
  • 26
  • 54
6
votes
1 answer

Docker: MySQL container bind host mysqld socket

I am using Docker 19.03.8 and want to setup two containers: The first is a MySQL container which bind mounts the mysqld socket from the host. The second one is a PHP container which needs to access the database via the MySQL container. Both…
Dominik K
  • 399
  • 3
  • 9