.NET
  Home arrow .NET arrow Page 2 - 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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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 - Types of Handles


    (Page 2 of 5 )

    There are two types of handles that we use while we program using RPC: Binding handles and Context handles. As an extension to the Standard RPC, Microsoft also provides a third type of handle: the serialization handle. These are used to encode or decode data. Just remember that these are used for serialization on a local computer only and do not involve any remote bindings. Here, we’re going to discuss the Binding and Context handles only and look at their usage.

    Binding Handles

    Binding handles come into the picture when we try to establish a logical connection between a client program and a server program. In fact the information that is needed to create a binding between a client and server is represented by a structure called a binding handle. Thus the binding handle is analogous to any other handle in the Win32 world: it just hides the binding information from the programmer and allows the RPC runtime to use it in an orderly fashion. The programmer is allowed to use and manipulate this information through a set of APIs that RPC runtime provides in the Windowing API that allows us to change the behavior or appearance of a window, if we have its handle. This way the run-time libraries access and manipulate the data appropriately on the programmer’s invocation.

    Context Handles

    Context handles, on the other hand, are needed to maintain a state between a client and a server. Consider the case of an Internet session where a user visits a publishing company’s Web page and orders a few books. Next he chooses to pay online and in this process he reaches a page to input his credit card information. At this point is the information about books to be purchased lost? No, certainly not. Then how is this information moved from page to page? The browser maintains a session with the Web server and sends the state information to the Web server with each request to maintain the session, regardless of whether that information is about a book's title or the credit card details. In the case of RPC, context handles manage the state in a similar fashion. The state information is usually termed server’s context, which clients can use to identify a server for their individual RPC sessions.

    It’s important to note that the context handle always represents information relevant to the sever side of the communication, but the client can always use it to pass some information to the server. Let’s say a server manages a number of files at the request of several clients. In this case, the server may use the file handle (which is unique on the server side) as the context handle. When a client sends a request, it also needs to send a context handle to tell the server which file to operate on -- which is, in fact, a valid file handle on the server side. In essence the client does not actually get the file handle itself; it gets an opaque token that the server RPC run time can uniquely associate with the file handle. Mostly, a context handle points to a block of memory on the server where the server keeps any management information.

    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

    - Introducing .NET
    - Building Business Objects for an Application
    - Methods for an Application`s Business Logic ...
    - Properties of an Application`s Business Logi...
    - Classes and Properties in an Application`s B...
    - Organizing Code for the Business Logic Layer...
    - Building the Business Logic Layer
    - Completing a Business Layer with Windows Wor...
    - Building Applications with Windows Workflow ...
    - Building the Data and Business Layers Using ...
    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 12 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek