Trying to understand DCOM's network traffic
From: Nick Palmer (nick_at_kcicorp.com)
Date: 06/09/04
- Next message: *** Grier: "Re: Timers and DoEvents"
- Previous message: MikeD: "Re: Timers and DoEvents"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 9 Jun 2004 07:50:01 -0700
Hi all,
I'm encountering some strange behavior with DCOM and wanted to explain what
I'm doing, then what I'm observing, and then see if hopefully somebody can
explain it.
So, I have a server object which runs as an out process exe on my remote
server. When an instance of this server object is created, it in turns
creates an instance of another secondary object on the remoter server and
then assigns this object to a public property of my server object. On the
client, after it creates an instance of the remote object, it uses the
public property of the remote object to get at this secondary object that
has been created on the remote server and then goes happily on its way. So
the client code looks like this
Dim oLibObj as object
Dim oRemoteServerObj as object
Set oRemoteServerObj = CreateObject"RemoteObject", EngineLocation.Text)
' assuming success, grab the secondary object
Set oLibObj = oRemoteServerObj.oLib
' now just use oLibObj
When I'm done, I set oRemoteServerObj to nothing as well as oLibObj.
Now this all works fine and has for a while. The reason for using a cover
object, in this case "oRemoteServerObj" is so that we can change the
underlying secondary object and not have to re-regsiter it each time on the
client and server. So, now we are trying to improve performance of this
over a slow network connection. So one of the ideas that we came up with
was to bunch up property gets, so that a function could return multiple
object properties in one go, thus saving us round trips to the server. So,
we wrote this and tested it and it does in fact improve performance. But
what we failed to do was watch the network traffic after we had done our
call to return mulitiple properties. Basically, the function returns all
the properties that you request into a variant, and then you can go and pull
them out and use them as you need. So the code is like this :
Dim vResults as variant
Dim vProperties as variant
Dim Info As Variant, Description As String, Error As Variant
Dim TrackChanges As Boolean,
vProperties = Array("Info", "Description", "Error", "TrackChanges")
vResults = oLibObj.GetProperties(Array(4, vProperties))
Info = vResults(0)
Description = vResults(1)
Error = vResults(2)
TrackChanges = vResults(4)
This all works fine. But, here is were things get confusing. What I have
found is that when I start assiging the local variables from the vResults
array such as Info, Description, Error or Trackchanges above, this results
in network communication between the client and the server machines. Its
almost as if the vResults variable knows that it is referencing the remote
server. Now, if I try assigning the GetProperties results to a different
variable, then assigning vResult to this, then setting the return variable
to nothing this doesn't cause any change. Interestingly enough, if I kill
the remote server object, the program will still let me read the results out
of my result variable. So it seems like the results variable knows that it
has a reference to the remote server object, but if the remote server object
is gone, it still has the results locally and will work. There appears to
be some kind of binding going on.
So, my question is basically this. Is this the expected behavior of DCOM
(and COM I guess too) ? And if it is, is there some way for me to get
around this ?
All the work I'm doing here is in VB, so I guess alot of the guts of
COM/DCOM is hidden from me.
So thats what I'm observing. Anybody have any idea about this ?
Thanks in advance,
Nick
- Next message: *** Grier: "Re: Timers and DoEvents"
- Previous message: MikeD: "Re: Timers and DoEvents"
- Messages sorted by: [ date ] [ thread ]