|
-
Aug 17th, 2001, 01:07 AM
#1
Thread Starter
Hyperactive Member
COM RaiseEvents
If I have several client object using a single server COM object using DCOM, and one client raise an event from the server, how can the other clients in other locations be informed as well (assuming all the other clients have an event handlers as well ?)
William T
Software Architect / Chief Software Developer
Softwaremaker.Net Pte Ltd
http://www.Softwaremaker.net
*** Things are always the darkest before they go pitch black ***
-
Aug 17th, 2001, 02:58 AM
#2
Well ...
The COM object will raise an event in response to some activity. This event can be trapped by all the applications/clients using the object. You don't raise events from the clients to the COM object, and the event raised by the object is trappable by all clients.
For e.g. application A and application B access a COM object C. C has been so programmed that it will accept a string from the client and display it in a message box. If the string is "honeybee" the object C should raise an event and notify any client that "honeybee" has been passed.
Application A passes a string "cute" to object C. It is displayed in a message box. Application B passes another string "beautiful" and that too is displayed in the message box. Next Application A once again passes the string "honeybee". On recognizing this string, C will raise an event. This event can be handled in both the clients.
Sorry, I forgot to add: This will work only if the object is the same. If both the clients are using different instances of the DCOM object, the above method may not work.
.
-
Aug 17th, 2001, 03:44 AM
#3
Thread Starter
Hyperactive Member
The thing is with DCOM and MTS, COM are multithreaded objects.
So if 5 clients are accessing 1 server at a time, A will trap an event but BCDE will not be informed that A has trapped an event as they do not share global data with different threads. Each thread has their own data but with the same variable name.
I found the only way (I think) to do this is to provide synchronization via cross-thread marshalling (which is REAL slow) and the only way to implement this is NOT RaiseEvent but an older, but more powerful method of OLECallbacks.
Ironically RaisingEvents is made to replaced OLECallbacks. RaisingEvent are easier to code and understand whereas OLECallbacks are harder to conceptualize BUT more powerful
William T
Software Architect / Chief Software Developer
Softwaremaker.Net Pte Ltd
http://www.Softwaremaker.net
*** Things are always the darkest before they go pitch black ***
-
Aug 17th, 2001, 05:59 AM
#4
Here although it sounds like you already have everything under control and know what you are talking about.
http://forums.vb-world.net/showthrea...221#post485221
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|