.NET
  Home arrow .NET arrow Page 4 - Introduction to RPC on Windows, Part II
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Introduction to RPC on Windows, Part II
By: Digvijay Chauhan
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 9
    2005-01-17

    Table of Contents:
  • Introduction to RPC on Windows, Part II
  • Types of Handles
  • Types of Binding Handles
  • Implicit binding handles
  • Explicit binding handles

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Introduction to RPC on Windows, Part II - Implicit binding handles


    (Page 4 of 5 )

    With implicit binding handles, the client program gets a chance to configure the binding handle before the binding actually takes place. Once the client establishes a binding, the RPC run-time library takes over and handles the rest of the communication on its own. Thus implicit binding handles allow your application to specify a server as the target to your remote procedure calls. Here you need to set the binding information as the client application starts executing so that it may create the binding. After the binding is created once, the client application does not need to pass any binding handles as a parameter to remote procedure calls it makes because it has already "Implicitly" expressed that. The other chores of the communication session are managed by the RPC Runtime automatically.

    The client application needs to store this binding information as an implicit handle in a global variable. When the MIDL compiler generates the client stub and header file from the interface specification in your MIDL file (as we saw in the last article), it also generates code for a global binding handle variable that stores the binding handle value once the client creates it, and then it need not refer to it again until it explicitly destroys the binding.

    You can create an implicit binding handle by specifying the [implicit_handle] attribute in the ACF (Application Configuration File) for the RPC interface as follows:

    /* ACF file */
    [
      implicit_handle(handle_t hImplicit)
    ]
    interface IMyRemoteProcedures
    {
     HRESULT MyRemoteCall();
    }

    The handle_t data type, which we used in the example above, is a MIDL data type used for defining binding handles.

    After creating the implicit handle as shown above, you may use this handle whenever you make calls to the RPC run-time library functions. Please note that the implicit handle must never be passed as a parameter to the remote procedure calls you make. The following code snippet shows the correct usage of implicit binding handles.

    RPC_STATUS status;

    status = RpcBindingFromStringBinding( pszStringBinding, &hImplicit);
    status = MyRemoteCall();
    status = RpcBindingFree(hImplicit);
    // other code

    In the above example, the RPC run-time library functions RpcBindingFromStringBinding and RpcBindingFree required the implicit binding handle, which we save after binding is established, to be passed in their parameter lists. However, the remote procedure MyRemoteCall did not, since it is not an RPC run-time library function.

    More .NET Articles
    More By Digvijay Chauhan


       · Hi I'm Digvijay ....... the author of this article.Please feel free to ask any...
       · I do like your explaination on the topic of RPC. I try to used them to solve...
       · Thank you for your article. I am having a problem where the sever denies access to...
       · Hi,I didn't get what you're trying to solve. Could you please give me the...
       · What is the exact error do you get?Would you like me to take a look at the...
     

    .NET ARTICLES

    - Using CrystalReportViewer to Display Crystal...
    - Creating Summary .Net Crystal Reports
    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT