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

What is the cost of establishing connection using Unix Domain sockets versus TCP sockets?

Oddly I didn't find this info by googling. What is the cost of establishing connection using Unix Domain sockets versus TCP sockets? Right now I have to do connection pooling with TCP sockets because reconnecting is quite expensive. I wonder if I…
expert
  • 29,290
  • 30
  • 110
  • 214
10
votes
4 answers

Can not connect to Linux "abstract" unix socket

I'm trying to use UNIX sockets for inter-thread communication. The program is only intended to run on Linux. To avoid creating the socket files, I wanted to use "abstract" sockets, as documented in unix(7). However, I don't seem to be able to…
Pawel Veselov
  • 3,996
  • 7
  • 44
  • 62
9
votes
4 answers

PostgREST on Google Cloud SQL: unix socket URI format?

Any of you with experience with PostgREST and Cloud SQL ? I have my SQL instance ready with open access (0.0.0.0/0) and I can access it with local PostGREST using the Cloud proxy app. Now I want to run Postgrest from an instance of the same…
J Dumont
  • 113
  • 6
9
votes
0 answers

How to use socat proxy to intercept Unix domain socket sending ancillary data?

I have two programs, a server and a client. The server opens a file, writes data to it, and then send its file descriptor to the client over a unix domain socket. Everything works fine untill I introduce a socat proxy in between. socat -x -v…
Sahil Singh
  • 3,352
  • 39
  • 62
9
votes
1 answer

Is IPC with unix domain sockets are safe?

I am planning to use unix domain sockets for my IPC (inter process communication) between two processes running on same host machine. But I have to look into data security also before choosing unix sockets. I just wanted to know is there any way…
Harish
  • 343
  • 1
  • 4
  • 14
9
votes
2 answers

Warp: Binding to Unix Domain Sockets

The example code listed here shows how to make warp listen only on specific hosts. Furtheremore, this post shows some basics on how to use unix domain sockets in Haskell. How can I combine those two approaches in order to make warp listen on (i.e.…
Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
9
votes
1 answer

What causes ECONNREFUSED on UNIX Domain Sockets?

In TCP servers, I understand that a Connection Refused would either be because the The process stopped listening, by calling close on the server-socket (existing connections stay open, and new connections are refused), or The process ended, or The…
700 Software
  • 85,281
  • 83
  • 234
  • 341
9
votes
1 answer

How to connect to a redis server via Unix domain socket using hedis in Haskell?

I'm looking for how to connect to a redis server via Unix domain socket using hedis, as advertised in the hackage page: Connect via TCP or Unix Domain Socket: TCP sockets are the default way to connect to a Redis server. For connections to a…
Xiao Jia
  • 4,169
  • 2
  • 29
  • 47
9
votes
1 answer

Python: code.interact(local=locals()) where stdin/stdout are not available

In Python, the following code snippet will open an interactive shell upon execution. import code; code.interact(local = locals()) This has proved tremendously useful for debugging in quite a bit of code that is poorly documented. One can use the…
Teekin
  • 12,581
  • 15
  • 55
  • 67
9
votes
2 answers

Unix Domain : connect() : No such file or directory

as stated in the title, my connect() call to an unix domain type socket with an according address results in the error ENOENT: no such file or directory. The two sockets are properly initialized and the socket files are created and bound…
xQuare
  • 1,293
  • 1
  • 12
  • 21
8
votes
2 answers

Connect to Unix domain socket as client in Haskel

I can't find a good info on dealing with Unix Domain sockets in Haskell. I need a simple function to open a socket and write a command to it. Can anyone help me with an advice of where to read about this or maybe give an example? Basically, I need…
r.sendecky
  • 9,933
  • 9
  • 34
  • 62
8
votes
1 answer

How do I (nicely) send HTTP over a unix-domain socket in .NET Core

In .NET Core I can send raw HTTP over a unix-domain socket, but I would like to use the HTTP handling classes in the library instead of hacking together my own HTTP handling. Here is my current working-but-ugly code: const string HTTP_REQUEST =…
cdjc
  • 1,039
  • 12
  • 24
8
votes
2 answers

Why does `forever` mean this code doesn't read from a socket or print to stdout?

I have written a systemd socket activated service in Haskell. The idea is the service should be started automatically when a message is sent to its socket, the service should process all messages waiting on the socket and then exit. Note: the reason…
user4301448
  • 191
  • 10
8
votes
0 answers

Why aren't UNIX domain sockets removed automatically when no longer referenced?

When a process binds a name to a TCP socket (i.e. ip:port pair) and exits, it doesn't has to explicitly cleanup anything: another process can reuse the same ip:port. Same with the abstract UNIX sockets on Linux (when sun_path starts with zero byte).…
Oleg Andriyanov
  • 5,069
  • 1
  • 22
  • 36
8
votes
0 answers

Sequelize connect to Postgres over Unix socket

I would like to connect to Postgres using Sequelize over Unix socket (not over localhost). Postgres is configured to accept Unix socket connections from user pgdba. All works from command line with psql. So the Pg side is correctly configured. I…
Thalis K.
  • 7,363
  • 6
  • 39
  • 54