Recent

Author Topic: ipc between different users  (Read 1630 times)

tintinux

  • Sr. Member
  • ****
  • Posts: 382
    • Gestinux
ipc between different users
« on: August 30, 2025, 10:30:54 am »
Hi

Using  Linux Ubuntu 24.04 and Lazarus 4.2.0

I compile and run  simpleipcserver (server) and checkipcserver (client) taken without change from the examples provided in the distribution.

It works fine when both are launched by the same user.
When the server is launched by an user different of the the client, it is not found  by the client ("Server is NOT runnning").

The property Global is set to TRUE in the server source.
It is written in https://wiki.freepascal.org/SimpleIPC : On multiuser systems, eg, Unix systems, in Global Mode, note that the pipe that IPC creates must have a distinctive name between individual users. Doesn't it suggest that it should work system wide, between different users ?

Is there something to add, to make it work ?  Or isn't it possible ?

Thanks
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

tintinux

  • Sr. Member
  • ****
  • Posts: 382
    • Gestinux
Re: ipc between different users
« Reply #1 on: August 30, 2025, 11:18:59 am »
The strange thing is that in the sources (simpleipc.pp)  the property Global (or the variable FGlobal) are never used...
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

n7800

  • Hero Member
  • *****
  • Posts: 740
  • Lazarus IDE contributor
    • GitLab profile
Re: ipc between different users
« Reply #2 on: August 31, 2025, 11:26:31 am »
The strange thing is that in the sources (simpleipc.pp)  the property Global (or the variable FGlobal) are never used...

If you right-click and select "Find > Find Identifier References" you can find one usage. Judging by the file, it's only used on Windows.

It is written in https://wiki.freepascal.org/SimpleIPC : On multiuser systems, eg, Unix systems, in Global Mode, note that the pipe that IPC creates must have a distinctive name between individual users. Doesn't it suggest that it should work system wide, between different users ?

Is there something to add, to make it work ?  Or isn't it possible ?

I think I see an open issue on the compiler bug tracker about this.

dbannon

  • Hero Member
  • *****
  • Posts: 3882
    • tomboy-ng, a rewrite of the classic Tomboy
Re: ipc between different users
« Reply #3 on: August 31, 2025, 02:55:49 pm »
I think if you want to have IPC between concurrent users, DBus is probably the approved way to do so. At least on Linux ....

Davo
Lazarus 4, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Thaddy

  • Hero Member
  • *****
  • Posts: 19611
  • Glad to be alive.
Re: ipc between different users
« Reply #4 on: August 31, 2025, 04:13:30 pm »
Correct. I would also use dBus here.
At good introductary article - for intermediate programmers - is still Michael van Canneyt's https://www.freepascal.org/~michael/articles/dbus2/dbus2.pdf
Also has the sourcecode here: https://www.freepascal.org/~michael/articles/dbus2/dbus-code.zip

It is 15 years old but still good for the current FPC.
« Last Edit: August 31, 2025, 04:17:24 pm by Thaddy »
Any "programmer" that knows only one programming language is not a programmer

tintinux

  • Sr. Member
  • ****
  • Posts: 382
    • Gestinux
Re: ipc between different users
« Reply #5 on: September 01, 2025, 08:01:09 am »
Thanks for your answers.

I tried with IPC and it works not too bad for my needs.
Provided there is no need to exchange between different users (or machines of course).

DBus looks is much more complex and the article says it requires a daemon.
There is not much information about this daemon, but if a permanent service is required, it is a nogo for me.
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

Thaddy

  • Hero Member
  • *****
  • Posts: 19611
  • Glad to be alive.
Re: ipc between different users
« Reply #6 on: September 01, 2025, 08:19:26 am »
dbus is part of most linux desktop environments nowadays, its daemon is  likely always running.
« Last Edit: September 01, 2025, 08:33:14 am by Thaddy »
Any "programmer" that knows only one programming language is not a programmer

 

TinyPortal © 2005-2018