Share via


DCOM: Is there a way to get the IP of the DCOM client from the DCOM server?

Another FAQ. Short answer: may be. Shorter answer: no. To be honest: no supported way.

CoQueryClientBlanket() will give "some information", such as the user name and domain name, but unfortunately, there is no way of obtaining the client machine name or IP address from a DCOM application. This is because there is no way to get RPC Binding Handle inside a DCOM server. If you have a RPC application then you have a RPC binding Handle and this will have information about the client.

If you look at Inside Distributed COM by Guy Eddon & Henry Eddon and/or Don Box's article in MSJ back in 98, they talk about the "unpublished and unsupported (by MS)" interface IChannelHook which can be used to obtain the Client address. Both client and server needs to Activate IChannelHook to its process. Microsoft does not recommend nor does it support the use of IChannelHook or any other unpublished interfaces/APIs.

Speaking of "unpublished and unsupported" API's, the web site https://members.tripod.com/IUnknwn gives an example of how to marshal an interface pointer to a stream, and then look at the OBJREF structure that is part of the marshaled interface pointer (as described in Chapter 12 of Inside Distributed COM by Guy Eddon and Henry Eddon). The OBJREF structure contains the client's STRINGBINDING when standard marshaling is used, which contains the client's IP address.