473,321 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Question regarding sharing objects between applications

Is there any way to share an object or variable between applications other
than through .NET remoting? Also, if this is the only way, what kind of
overhead is there for storage (memory) and speed vs local objects and
variables?

In my case the remote and the client are on the same machine. I would just
be using remoting to share the variable between two instances of the same
application - ie. two different processes or possibly application domains.

Thanks,
____________________
Michael Isaacs - MCP
Consultant
Nov 20 '05 #1
2 1066
Anytime an object lives in another process (whether it's on the local
machine or somewhere else on a network), remoting is involved because two
processes can't access each-other's memory natively.

In .NET, the remoting infrastructure can detect two scenarios: (1) remote
objects in the same process (but maybe in different app domains), and (2)
remote objects in different process

COM was able to detect a third scenario, which was, a remote object in
another process, but on the same computer. When this happened, COM was able
to marshal the calls around without physically using networking and sockets.
In .NET, anytime an object lives in another process, you are going to have
to resort to networking/socket calls (TCP or HTTP) if you use the default
remoting channels.

Luckily, remoting channels are extensible and you can make your own. A while
back, I created a custom channel that used windowless message pumps on both
sides to signal incoming messages, and serialized the message data to a
memory mapped file. Normally, the binary tcp channel uses a TCP socket to
signal and transmit messages, and serializes the message data to the network
stream. My custom channel bypassed the need to use sockets, and worked a bit
more like the COM scenario. If you wanted to switch the objects out to
another machine, then you could simply configure the TCP remoting channel
instead, and it required no code to swap channel types. I highly suggest
getting the MS Press Remoting book, and checking out Ingo Rammer's site.

Of course, all this might be somewhat overkill depending on what you are
doing. If all you want is to share simple types across two processes on the
same machine, you can try writing them out to a memory mapped file from one
process and reading it from the same memory mapped file on the other
process.

As a side note, Indigo (the next generation infrastructer for "remoting" if
you will) which will ship for both XP and Longhorn later this year or
sometime next year (by all indications... don't quote me on that - even the
MS people don't have a hard date) will simplify this stuff. I hesitate to
talk too much about Indigo because it's still in development and some
features and specs aren't public yet, but I do recommend you start becoming
familiar with it.

-Rob Teixeira [MVP]

"Michael Isaacs" <ms*******@isaacsonline.org.nomoresmp> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Is there any way to share an object or variable between applications other
than through .NET remoting? Also, if this is the only way, what kind of
overhead is there for storage (memory) and speed vs local objects and
variables?

In my case the remote and the client are on the same machine. I would just be using remoting to share the variable between two instances of the same
application - ie. two different processes or possibly application domains.

Thanks,
____________________
Michael Isaacs - MCP
Consultant

Nov 20 '05 #2
Anytime an object lives in another process (whether it's on the local
machine or somewhere else on a network), remoting is involved because two
processes can't access each-other's memory natively.

In .NET, the remoting infrastructure can detect two scenarios: (1) remote
objects in the same process (but maybe in different app domains), and (2)
remote objects in different process

COM was able to detect a third scenario, which was, a remote object in
another process, but on the same computer. When this happened, COM was able
to marshal the calls around without physically using networking and sockets.
In .NET, anytime an object lives in another process, you are going to have
to resort to networking/socket calls (TCP or HTTP) if you use the default
remoting channels.

Luckily, remoting channels are extensible and you can make your own. A while
back, I created a custom channel that used windowless message pumps on both
sides to signal incoming messages, and serialized the message data to a
memory mapped file. Normally, the binary tcp channel uses a TCP socket to
signal and transmit messages, and serializes the message data to the network
stream. My custom channel bypassed the need to use sockets, and worked a bit
more like the COM scenario. If you wanted to switch the objects out to
another machine, then you could simply configure the TCP remoting channel
instead, and it required no code to swap channel types. I highly suggest
getting the MS Press Remoting book, and checking out Ingo Rammer's site.

Of course, all this might be somewhat overkill depending on what you are
doing. If all you want is to share simple types across two processes on the
same machine, you can try writing them out to a memory mapped file from one
process and reading it from the same memory mapped file on the other
process.

As a side note, Indigo (the next generation infrastructer for "remoting" if
you will) which will ship for both XP and Longhorn later this year or
sometime next year (by all indications... don't quote me on that - even the
MS people don't have a hard date) will simplify this stuff. I hesitate to
talk too much about Indigo because it's still in development and some
features and specs aren't public yet, but I do recommend you start becoming
familiar with it.

-Rob Teixeira [MVP]

"Michael Isaacs" <ms*******@isaacsonline.org.nomoresmp> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Is there any way to share an object or variable between applications other
than through .NET remoting? Also, if this is the only way, what kind of
overhead is there for storage (memory) and speed vs local objects and
variables?

In my case the remote and the client are on the same machine. I would just be using remoting to share the variable between two instances of the same
application - ie. two different processes or possibly application domains.

Thanks,
____________________
Michael Isaacs - MCP
Consultant

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: AnalogKid | last post by:
Short question: What's the difference between SingleUse and MultiUse ? Long question: I've been writing some sample code to see how different Instancing values and threading models work. I...
4
by: Fahad Ashfaque | last post by:
Hi, Please correct me if I go wrong anywhere in my understandings. 1- ISessionObject is created each time When any ASP Page is started executing and destroys on the page ends (not session...
44
by: lester | last post by:
a pre-beginner's question: what is the pros and cons of .net, compared to ++ I am wondering what can I get if I continue to learn C# after I have learned C --> C++ --> C# ?? I think there...
18
by: Andre Laplume via AccessMonster.com | last post by:
I have inherited a bunch of dbs which are are shared among a small group in my dept. We typically use the dbs to write queries to extract data, usually dumping it into Excel. Most dbs originated...
6
by: Sajid Saeed | last post by:
Hi All, I wuld like to know if there is any possibility of sharing a common class between different applications. i.e. if the two applications are running, they can share the class, and changes...
2
by: Michael Isaacs | last post by:
Is there any way to share an object or variable between applications other than through .NET remoting? Also, if this is the only way, what kind of overhead is there for storage (memory) and speed...
1
by: trialproduct2004 | last post by:
Hi all, I am having slight confusion regarding memory management in .net. Say suppose i have two application one is in C# and other is in MFC(VC++). Both of this application are using lots...
8
by: maneeshkhare | last post by:
I have a doubt regarding the architecture, and working of the ASP.NET framework. I haven't been able to satisfy myself with any answer. I do understand that for each request for a resource...
8
by: antonyliu2002 | last post by:
We are extending a web application written in classic ASP long time ago. We will add more components to this web application in ASP.NET 2.0. To use the web application, our web users will have...
5
by: Regnab | last post by:
I have a table "tblSprayApplication" in a project for a nursery. Each record refers to a single spray application across the nursery, recording which groups had been sprayed. Multiple applications...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.