views:

74

answers:

5

I have an EXE and DLL running in different process. From DLL I have to send large of amount of data to EXE, which would vary from 50 chars to 2000 chars and more(The data is recordid of records saved in DB).

I thought about two options to do that:

  1. Using SendMessage- In which data's will be sent in batch.
  2. Use an Intermediate file to transfer data.

Can anyone list out the pros and cons of methods.

I have developed my components using C#.NET

A: 

Use shared memory as a buffer.

Here is a link

http://www.codeproject.com/KB/DLL/Share_memory_throuth_DLL.aspx

lbownik
Thank you so much for the reply!! Is there any other way i could do without using a shared dll??
Karthik
+1  A: 

You can use a named pipe. Unless the communication between your two processes is very frequent, this will do fine and is pretty easy to configure.

Another answer here suggested using shared memory as a buffer. That works too, but is likely to be more effort. It is only worthwhile if you move a lot of data between the processes.

Ira Baxter
+1  A: 

There exists a number of methods of various complexity. The easiest way is to employ the already available solution, such as MsgConnect. It lets you send messages on local computer or across network using one of several transports, such as memory-mapped files (for local communication only), sockets or HTTP. It's APIs are very similar to SendMessage*() Windows API functions, but work almost transparently across network.

Eugene Mayevski 'EldoS Corp
A: 

Another easy to setup solution is using a database.

Specially if you cannot be sure that both processes are active on the same time, you could use a database (Sql Server Express or Compact) to queue the data.

This will also enable two way communication.

GvS
A: 

I think @Ira's named pipe is probably the simplest and thus best solution. But most of the communication mechanisms, I'm pretty sure, eventually drop into a shared memory file implementation. If you willing to feel the pain, .NET 4 has support for memory mapped files. Hopefully, this link is helpful.

kenny