Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2005

Tip: Looking for answers? Try searching our database.

Communication between appdomains

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Juan Dent - 07 Jul 2005 23:33 GMT
Hi,

I have the following situation:

2 appdomains that both use an assembly (DLL). There is important information
in this DLL which can be modified at runtime by either appdomains. What I
need is a mechanism so that I can notify one appdomain when the other has
made any changes.

How can I do this? .NET Events don't seem to cut it, and looking at
Richter's Programming Applications for MS Windows, 4th edition, the only
thing that looks like a possible solution is the use of a shared section with
a variable (although I suspect I would need to do this in C++), or memory
mapped files. Both of which I have 0 experience with, and would rather remain
within .NET territory.

Any help?
Signature

Thanks in advance,

Juan Dent, M.Sc.

"Peter Huang" [MSFT] - 08 Jul 2005 04:01 GMT
Hi

In .NET we use remoting to communicate between AppDomain.
Based on my understanding, you will create two appdomains and they will
load the same assembly dll.
I did not understanding your scenario very well, what do you mean by
"modify the information at runtime", how and what do you do that?
Can you describe it more clearly?

Here are some links about appdomain programming.
AppDomains ("application domains")
http://blogs.msdn.com/cbrumme/archive/2003/06/01/51466.aspx

Copying, Cloning, and Marshalling in .NET
http://www.ondotnet.com/pub/a/dotnet/2002/11/25/copying.html?page=3

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Juan Dent - 08 Jul 2005 18:05 GMT
Hi and thanks. Let me rephrase my question:

How can I invoke a method that lies in a .NET DLL that is loaded by two
distinct AppDomains?  See, I need to call the method when one of the
AppDomains makes a certain change that invalidates some data in the DLL.

Is this clearer?

Signature

Thanks in advance,

Juan Dent, M.Sc.

> Hi
>
[quoted text clipped - 19 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 09 Jul 2005 03:11 GMT
Hi

So if you want to invoke the method, we need to tell the runtime in which
AppDomain you want to execute the method.
If a dll is loaded into two appdomain, we can consider there are two dll
copy in the memory, each appdomain own one.
If certain dll's method will create a new object, then we execute the
method in appdomain A, then the object will be created in appdomain A, if
we execute the method on Appdomain B, another object will be created on
appdomain B.

If now we change the object in Appdomain A, the Appdomain B's object will
not change.

We can consider the appdomain as a process in win32 category.
For how to call a method in certain appdomain from another appdomain, you
may refer to the links I post before.

Also can you tell us why you wants to do that? what is your concrete
scenario?

BTW I think you may try to take a look at the two books about process,dll,
thread, appdomain.
Programming Applications for Microsoft Windows (Dv-Mps General)
by Jeffrey Richter
http://www.amazon.com/exec/obidos/tg/sim-explorer/explore-items/-/1572319968
/0/101/1/none/purchase/ref%3Dpd%5Fsxp%5Fr0/103-8401450-8094224

Applied Microsoft .NET Framework Programming
by Jeffrey Richter
http://www.amazon.com/exec/obidos/ASIN/0735614229/qid=1120875040/sr=2-1/ref=
pd_bbs_b_2_1/103-8401450-8094224

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Juan Dent - 15 Jul 2005 01:38 GMT
Thanks for your help. I finally found a way to do what I wanted. Basically I
synchronized via a file and used FileSystemWatcher.

Thanks again. Your comments were helpful!

Juan Dent, M.Sc.

> Hi
>
[quoted text clipped - 36 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 15 Jul 2005 03:26 GMT
Hi Juan,

I am glad that you  have worked out the problem.

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.