tags:

views:

24

answers:

1

I suppose this question is more general than working with COM components. I have a .NET client written in C# and COM component written in pure Win32 API. Client side uses this component to perform some actions. How to know on the client that component did its job?
I think it may be socket/pipe, with component writing to it about results, and client reading from it displaying progress to the user. What is the best way to do this?

+2  A: 

With COM, you do not control the data flowing over the socket. You have an RPC-like interface, i.e. your client calls a method on a server, which returns a result. There is no notion of streaming results.

In order to do what you mention, you need to design the interface implemented by the client such as, when starting a job, the server returns an identifier and performs the job asynchronously. Then, the client can regularly poll the server, giving the identifier as parameter and asking the server for the actual progress.

Another way to do it is to implement a connection point on the server, which is essentially a callback mechanism, so that the server can inform the client of its progress. See CodeProject 1 or CodeProject 2 for more information.

Timores