C ++: the most common way to talk with one application from another

In simple loops, I have an application that looks at directories at startup and creates an index of special files - after that it works like a daemon. Another application creates such “special” files and places them in some directory. What method of informing the first application about a new file (for indexing) is the most common, simple (the first of them is runtime, so it should not be too slow) and cross-platform, if possible

I looked at RPC and IPC, but they are too heavy (also not cross-platform and slow (I need a lot of functions to work - I need a simple easy way to work), maybe).

+3
source share
6 answers

Pipes would be one option: see Network programming using pipes and remote procedure calls (Windows) or Creating pipes in C (Unix).

I have not done this for some time, but from my experience with RPC, DCOM, COM, .NET Remoting and sockets, I think pipes are the easiest and most efficient option.

+7
source

For Windows (NTFS), you may receive a notification from the OS that the directory has been changed. But this is not crosspl. not about two applications.

“IPC, but they are too heavy” - no, they are not at all heavy. You should look at named pipes - this IPC is the fastest, and it is both in Win / Unix, and with slight differences. Or sockets!

+1

eisbaw TCP. , , UDP. , - .

, - , UDP .

, , ( ) .

(:

+1

, , , . . - , ​​ QFileSystemWatcher.

EDIT: , QFileSystemWatcher . Linux, FreeBSD Mac OS ( , Windows). . http://qtnode.net/wiki/QFileSystemWatcher

0

, , -, ipc-. , apis POSIX Win32, , . , ( ) , / .

0

Source: https://habr.com/ru/post/1737372/


All Articles