Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Detecting proxy presence

20 views
Skip to first unread message

Igor R.

unread,
Jan 4, 2010, 4:16:06 AM1/4/10
to
Hello,

Is it possible to know inside a server object (inproc) whether a call
was made through COM proxy, i.e. across apartments?

Igor Tandetnik

unread,
Jan 4, 2010, 8:11:56 AM1/4/10
to
Igor R. wrote:
> Is it possible to know inside a server object (inproc) whether a call
> was made through COM proxy, i.e. across apartments?

It is possible to know that there exist proxies on your object - just implement IExternalConnection. I can't think of any way to detect whether a particular call came from a direct client or through proxy. Why do you care?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925

Igor R.

unread,
Jan 4, 2010, 9:09:52 AM1/4/10
to
> It is possible to know that there exist proxies on your object - just implement IExternalConnection. I can't think of any way to detect whether a particular call came from a direct client or through proxy.

Ok, thanks!

> Why do you care?

I thought of implementing CPs differently depending on whether the
object and its client are in the same apartment. Meanwhile I gave up
on that idea, but anyway it's good to know.

Igor Tandetnik

unread,
Jan 4, 2010, 1:06:55 PM1/4/10
to
Igor R. <igor.r...@gmail.com> wrote:
> I thought of implementing CPs differently depending on whether the
> object and its client are in the same apartment.

Ah, so you don't actually need to know whether you are called through a proxy - you need to know whether an interface pointer you are given (a sink pointer) is a direct pointer or a proxy. Query it for IMultiQI - if it supports that, chances are very high it's a proxy (it is theoretically possible for a direct object to implement IMultiQI, but there's no reason to do so).

IRpcOptions is another interface of this kind (implemented by COM runtime on all proxies, extremely unlikely to be implemented on direct objects).

0 new messages