What are IPC Methods for Windows?

Question: I have a dll that I can load in another program. Now dll has access to all data / functions in another program.

What technology can I use, now an external program can send data / commands to this DLL, manage another program or get data from it?

I mean, in the past this meant DDE, I think it was on Windows 3.11 / 95 times. What can i use today? Which one is easiest? Which one is the fastest?

+4
source share
4 answers

Some of them:

  • Named Pipes Pretty easy to implement.
  • Shared memory . A bit more work, but maybe a little faster (at least in my testing).
  • Sockets It is quite simple and very portable, but not so high. But, of course, it’s nice if you suddenly want to contact a process running on another machine.
+6
source

COM is the de facto standard IPC mechanism for Windows-oriented applications at this time.

It provides access to language barriers, solves the binary compatibility problem, does transparent sorting for you, and has different stream models.

sharptooth summarized some facts here .

+4
source

Do not forget Remoting , for higher level features in .NET

0
source

For a quick and easy connection, you can consider Mailslots . They are pretty easy to use. You interact with them as with a file.

Mailslots are most suitable when you want to send commands to multiple recipients or receive messages from several producers, and your design may tolerate an occasional lost message. The named pipes mentioned above are better suited for a single IPC with guaranteed delivery from a process to a single process.

Good news

  • They are very easy to use.
  • They support asynchronous operation.
  • They can be used even if Windows Process is isolated. This means that you can use them to communicate between different user sessions (for example, using Windows services).
  • They can send messages to the entire domain by opening the mailbox for "\ * \ mailslot [path] name". When you write a mailbox with that name, it sends it to every mailbox with that name on every computer in your domain.

Bad news

  • Only 424 bytes can be transmitted over the network. More data can be transmitted locally.
  • They are UDP based, so use them if you lose your message from time to time.
  • Sometimes (especially on multiprocessor systems) messages can be delivered a little out of order.

Many samples are available, but I don't have enough posts yet to publish more than one in CodeProject in C ++

0
source

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


All Articles