Kevin Take a look at: ChannelServices.GetUrlsForObject
thanks -jhawk This posting is provided "AS IS" with no warranties, and confers no rights. -----Original Message----- From: Kevin Burton [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 9:55 AM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Where is the remote location in remote dele gates? If I use RemotingServices.GetObjectUri I get URI's that don't obviously have the machine name embedded in them. Maybe it is encoded in the numbers somewhere. Console.WriteLine("URI: {0}", RemotingServices.GetObjectUri(mbro)); Outputs: URI: /95f0e3a8_0e7e_45c0_83b7_a42d827195d6/523828250_1.rem URI: /ad770032_2b88_4216_8b2a_92ed6b6632b3/11365292_1.rem Kevin -----Original Message----- From: Ian Griffiths [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 6:21 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Where is the remote location in remote delegates? I don't think the delegate knows. It just has a reference to the object on which the method will be invoked. For remote objects, this object will be a proxy. (A Transparent Proxy, specifically.) When a delegate is marshalled from one AppDomain to another it actually gets serialized. As part of its serialization process, the object it refers to will be marshalled into an serialized object reference. This serialized objref will contain the machine name somewhere, along with the other information required to reconnect to the object. When the delegate is unmarshalled in the target AppDomain, this object reference is deserialized. This will cause the a proxy to be created that is connected to the appropriate object. But the delegate is none the wiser - all it knows is that it has a reference to the relevant object. The fact that after marshalling this reference is to a proxy is something it neither knows nor cares about. So, you could look in the delegate's Target property. For a remote object you should be able to cast this to MarshalByRefObject. (If you can't, then by definition the object you are talking to is in the same machine as you. In fact it's in the same AppDomain. It might have been marshalled by value from another machine, but if that's the case there is simply no way of knowing.) You can then call CreateObjRef on this, and the URI property on the returned ObjRef will probably contain the machine name. But it might not - it's all dependent on the remoting channels you have configured. -- Ian Griffiths DevelopMentor ----- Original Message ----- From: "Kevin Burton" <[EMAIL PROTECTED]> > I have a server process that keeps track of delegates that are passed to it. > Everything seems to work fine but I don't understand where the machine > location is kept. If I pass a delegate from 'localhost' and 'machineA' both > of the delegates get called but I don't understand how the remoting layer > keeps track of which machine corresponds to which delegate. I have tried to > look at the target and it doesn't seem to have the information. Any ideas > where I would look? You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
