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
0
votes
0 answers

Unix Socket Implementation sending sockaddr info

I would like to know if it is possible to create unix domain socket, with Socket_Stream configuration where server and client binds their own sockets so that they could be able to send their sockaddr information. In other words I would like to send…
Meric Ozcan
  • 678
  • 5
  • 25
0
votes
0 answers

C++: Setting network interface down does not cause linux sendto() function to fail

I have a nonblocking socket created as: sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); fcntl(sockfd, F_SETFL, O_NONBLOCK); It is then connected to the server via: struct sockaddr_in addr = {}; addr.sin_family = AF_INET; addr.sin_addr.s_addr =…
0
votes
0 answers

Can unix domain socket datagram server send and receive at same file?

Refer to the this. UDP INET server and client can send and receive at same side. But now I want use unix domain socket. Here are my code: client: #include #include #include #include #include…
Tim Cheng
  • 33
  • 8
0
votes
1 answer

Connect to docker.sock to get container stats using python socket only

So, I was trying to get some stats for the docker containers running on a server. I tried multiple approaches: Docker SDK for python Making curl request using subprocess module Socket The first two worked quite well but I could not employ the…
Mayank
  • 3
  • 3
0
votes
2 answers

Is there a Unix domain socket analog on Windows?

I'm writing a daemon which needs to accept unnamed pipe connections identified by a PID from potentially untrusted applications. With Unix domain sockets, this is not a complex task: create a socket on the filesystem, start listening, accept…
Kotauskas
  • 1,239
  • 11
  • 31
0
votes
1 answer

Unable to communicate between Node.js domain socket server and C domain socket client on Linux

Here is the Node.js code: net = require('net'); fs = require('fs'); serverSocketFile = '/tmp/_mediaComm'; if (fs.existsSync(serverSocketFile)) fs.unlinkSync(serverSocketFile); var server =…
asinix
  • 966
  • 1
  • 9
  • 22
0
votes
1 answer

How to create a unix socket file with read/write permissions for different users C++?

I have 2 different aplications running in 2 different users in linux. I want them to be connected by unix sockets and, as a unix domain socket is known by a pathname, the 2 applications need to share the same path and same the socket file that is…
Samuel
  • 816
  • 1
  • 7
  • 13
0
votes
1 answer

Successfull call to bind(2) with AF_UNIX does not generate a socket file

I have a program that should generate a socket. Using strace I get the following trace line bind(6, {sa_family=AF_UNIX, sun_path="/home/me/x"}, 110) = 0 However, "/home/me/x" does not exist and I see no call of unlink. May it happen, that no file…
till
  • 570
  • 1
  • 6
  • 22
0
votes
1 answer

In bash, reading from a socket through exec, via process substitution, doesn't work,

I feel a bit dumb asking this, but here it goes. I'm trying to implement a very simple ftp client in bash, for testing purposes, and thought I could use a clean approach at reading/writing from/to the socket using exec and process substitution, as…
Fabio A.
  • 2,517
  • 26
  • 35
0
votes
1 answer

Why does my Node.js server echo back everything I send to it from nc?

I am new to Node.js and I'm trying to learn by building a server that listens to a Unix-domain socket. I'm testing my server using 'nc' as a client. 'nc -U /var/run/ipc.sock' Everything is going well, except that anything I type in nc gets echoed…
Dave H.
  • 538
  • 5
  • 11
0
votes
1 answer

Implementing new routed protocol in python

I'm trying to build a simple router prototype in python with which I could test new routed protocols; let's say newly made up IPv7. From what I understood I cannot use sockets (socket.AF_INET) without modifying sys/socket.h file. If so, how would I…
0
votes
1 answer

could not create Unix-domain socket in directory "/var/run/postgresql"

I try to uncomment 'unix_socket_directories = '/var/run/postgresql' in postgresql.conf. But after doing that, when I try to restart postgresql, I receive Job for postgresql.service failed because the control process exited with error code. See …
Jelly
  • 972
  • 1
  • 17
  • 40
0
votes
1 answer

Why does recvfrom() for a UNIX domain datagram socket return Invalid Argument?

I'm working on a program that uses UNIX domain datagram sockes for IPC. Half the time it works fine, but the other half it returns "Invalid argument". I've confirmed that this shouldn't be due to a socket path reuse error, SO_REUSEADDR is set on the…
0
votes
0 answers

Is MATLAB able to communicate with Unix Domain Sockets?

Can MATLAB communicate with Unix Domain Sockets? I'm able to use the function tcpconnect over a TCP/IP Socket but it seems impossible with an UDS. Is there a solution to achieve this?
boubasse
  • 41
  • 2
  • 6
0
votes
0 answers

Having datadog listen to a socket in C++

I have a the following function to publish datadog metrics int PublishMetric(Metric* metric) { printf("Sending metric to datadog metric: %s value: %.2f\n", metric->metricName, metric->value); DogFood::Tags datadogTags; for (int idx=0;…
Zusman
  • 606
  • 1
  • 7
  • 31