Introduction to RPC on Windows, Part II
(Page 1 of 5 )
In this second article about using RPC on the Windows platform, we'll cover RPC handles, which should be handled with care. Keep reading to find out why, and how to use them.
In the previous article in this series we learned about the basics of using RPC on the Windows platform for developing Client/Server applications. It gave you a fair understanding of writing and integrating the MIDL generated code into your own applications, apart from the basics of using the MIDL compiler and the IDL language itself.
When we have the PRC mechanism to keep track of all the network communication for us we can devote more time to the business logic of the application being developed. But in order to design better solutions one needs to be aware of the issues that are encountered while we use RPC as the communication channel.
RPC handles are something that should be used with care because they determine how the communication will be established. In this article we are going to discuss just that. To understand the issues better, we’ll write code to observe the differences in the RPC context handle types.
So let’s get started now!
What are these RPC Handles?
When we program for Windows using plain old C, we see a lot of handles scattered all over the program, such as HMODULE, HWND or SCARDHANDLE. Moreover they all have different names in different places, to make them relevant to the code we write. So what’s different with these RPC handles?
Well, you may assume an RPC handle to be the equivalent of the "this" pointer that we see in the C++ language or the HANDLE returned from CreateWindowEx, or any other handle in Windows for that matter. They are basically different handles that behave somewhat differently based on the context, but they do accomplish the same thing: they all connect to an object, or rather encapsulate an object. Most of the context handles that you see while programming Windows are more or less opaque, but in the RPC world the context handles are 100 percent opaque, since they are defined to be pointers of type void*. Now let’s learn more about the different types of these RPC handles and more importantly the need for them.
Next: Types of Handles >>
More .NET Articles
More By Digvijay Chauhan