views:

160

answers:

5

is there any library, code sample, open source project, etc helping me share objects(a dataset , a collection, ...) between two or more programs with direct or indirect memory access.
if there is no way to do that, please show me other ways to make my app work.

language:c# .net
platform:vista x64

+1  A: 

You want to look at WCF - Microsoft's consolidated WebServices and Remoting framework. It provides a number of options for inter process communication, from XML over http to binary over TCP/IP or Named Pipes.

Some further articles:

flesh
what is it?how does it work?
Behrooz
@behrooz, go to the link and read about it...
James
+1  A: 

I believe your best and safest bet would be to check out Named Pipes via WCF. Straight from MSDN:

A named pipe is an object in the Windows operating system kernel, such as a section of shared memory that processes can use for communication. A named pipe has a name, and can be used for one-way or duplex communication between processes on a single machine.

Justin Niessner
and how should i send a System.DataSet(+200MB) over it?
Behrooz
can i put 200MB of memory in a pipe?
Behrooz
if i can do that ==> it is a cylinder.
Behrooz
Yes. It's just a lot of memory to be using...but there's nothing stopping you from transporting that much data.
Justin Niessner
i need direct access.and my programs can't wait for a response to their requests.--- i haven't used pipes before.---can they allocate memory as much as i need? can i resize the memory?
Behrooz
SQL Server provides Named Pipes as a transport method itself...so I have to assume that it could handle your dataset. The Framework will handle resizing the memory to fit the data you need to use it for.
Justin Niessner
Server writes them.client reads and deletes them i think.
Behrooz
A: 

I'm not aware of any so I'll leave someone else to answer. If it's not possible, and depending on whether both applications need to be aware of changes in real time you could potentially serialize your class to a file (e.g. XML) to share the current state information.

Ian
the applications are designed to monitor changes and response them.
Behrooz
A: 

you can use a file in a certain way or a database or any other persistent technology, messaging, WCF (or lower interprocess communication protocols)

you generally can't access one program memory address space from another without special hacks, definitely not in c#.

Dani
isn't there any way to do "special hacks" you talk about?
Behrooz
A: 

I am not very sure about how this can be accomplished but It might be possible if the assemblies are both in same domain. If one of the assembly loads the other assembly and gives it a pointer/reference to through which the second assembly can call into the first one then it might be possible to call a method inside the first assembly with parameters.

In one of my projects which is a COM addin written in C#, a COM dll instantiates two different classes from an assembly and they can share static data.

A9S6
they are in same domain.can you explain more please?
Behrooz
I am wondering if one of the assemblies are made COM Visible and the other one uses it as a COM Component then a method in assembly 1 can be called by assembly 2. You can try that out to see if it works.
A9S6
i can copy pointer of code to _mehodptr of delegate.it really works when DEP is desabled or i find a solution to get rid of DEP.
Behrooz