Which is better for local IPC, POSIX message queues (mqueues) or Unix domain (local) sockets?

2010-09-23T07:22:17

Is it better to use POSIX message queues or Unix domain sockets for local IPC communication?

I have worked with Unix sockets between machines (not domain) and I remember that making and breaking the connection would cause sockets to linger awhile before they finally went away. Moreover, if you wanted a "reliable" exchange you either had to use TCP or design the application to return an ACK. I'm not certain if this also applies to Unix domain sockets though.

In my current project we need local IPC. My first reaction was to use POSIX MQueues, since I've used them before for local messaging. However, a co-worker is suggesting Unix domain sockets instead.

Is one better than the other, or is it a matter of programming familiarity? Or perhaps its depends upon the application being created?

At a big picture the application we are working on follows a client/server model. The clients send messages to the server to "do something". However, the client doesn't wait for an "its done" response -- although they do want to know if their request has been received or not.

The basic logic for the send side is:

connect to server
send request
note if the send worked or not
disconnect from server

There can be hundreds of clients to the one server.

We're are executing on an SMP system (4-8 cores) running the Linux OS.

Thanks in advance.

Copyright License:
Author:「John Rocha」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/3774346/which-is-better-for-local-ipc-posix-message-queues-mqueues-or-unix-domain-lo

About “Which is better for local IPC, POSIX message queues (mqueues) or Unix domain (local) sockets?” questions

Is it better to use POSIX message queues or Unix domain sockets for local IPC communication? I have worked with Unix sockets between machines (not domain) and I remember that making and breaking the
I need to setup local IPC between client and server. It is a case of single server and multiple clients and data need to be exchanged in both directions. The client is a command which sends the com...
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
I need to set up some relatively simple IPC for Mac and it needs to be done using UNIX domain sockets. I'm brand new to Swift so while I know this is possible I'm struggling even create my client and
for (;;) { if (msgrcv(msqid, &flag, sizeof(struct flags) - sizeof(long), 1, IPC_NOWAIT)>0) break; } msgsnd(msqid, &message , sizeof(struct messages) - sizeof(long), 0)...
I've been playing with message queues (System V, but POSIX should be ok too) in Linux recently and they seem perfect for my application, but after reading The Art of Unix Programming I'm not sure i...
I am trying to establish communication between two different processes on Linux using POSIX IPC. I am using python 3 with posix message queues based on this library http://semanchuk.com/philip/pos...
IS there any known way to do Inter process communication between two operating system running on a same hardware and virtualized by XEN. I know i can do Remote Method Invocation(RMI/RPC) to do pr...
I am looking for asynchronous communication on Linux between 2 processes running on different machines. POSIX message queues seem a good solution for async part of it. It however seems like they are
I am using AF_UNIX,SOCK_STREAM socket for IPC between 2 different processes. The client is sending data over the socket which the server picks up and processes. The size of each block of data that ...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.