views:

53

answers:

2

The concurrency model can be either apartment-threaded or multi-threaded

Question:

  • How to ensure that both the Client and Server are operating from within the same concurrency model?
+1  A: 

If you need to know, there's something wrong with your design: the client and server need too much information about one another's internals. Part of the point of client-server is to decouple the two.

That said, then, there is a registry value ThreadingModel.There's an MSDN article on these things as well.

Charlie Martin
Thanks Charlie - I'm having some issues... moreover, I'm new to COM Programming. Kind regards
Aaron
NP, the COM model is a little tough going.
Charlie Martin
+1  A: 

Sometimes you need to know. Two quick examples:

  • Performance hit of proxy/stub pairs is a problem
  • You need to pass around "unmarshallable" data or objects

So, the answer -- if you do need to know:

The server and the client must be designed and implemented to support the same or compatible models. Either one of these scenarios will do:

  • Both should be MTA, or
  • Both should be STA, or
  • The server should be "Both" (supports either)
  • The Server should be "free-threaded" (but that doesn't buy you anything extra compared to Both, in this scenario)
Euro Micelli