.NET
  Home arrow .NET arrow Page 2 - Introduction to RPC on Windows: Part I
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 I
By: Digvijay Chauhan
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 24
    2005-01-10

    Table of Contents:
  • Introduction to RPC on Windows: Part I
  • Meet IDL
  • Doing the RPC stuff
  • Writing Server Side code
  • Writing Client Side Code
  • Points of Interest

  • 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 I - Meet IDL


    (Page 2 of 6 )

    If we’re to write applications using RPC on Windows, we must surely be aware of a language that can describe the interface that the server will expose to the client -- basically a channel that sets an agreement between the client and the server. IDL is just that such a thing!

    IDL stands for Interface Definition Language. It's a language for defining interfaces to which the client and server should adhere. You might be thinking, "what the heck? A new language just to define interfaces?! Can’t I just make a pure abstract class in C++ and use it?" I too wish that to be true but the fact of life is that the syntax of C or C++ doesn’t allow one to clearly mark a method quite precisely –- I mean in a way that both client and server running across process boundaries, or maybe machine boundaries, may communicate. Fortunately the syntax of IDL is very intuitive and similar to C/C++, and therefore is easy to grasp. So writing an IDL file is somewhat similar to writing a C header file with some added keywords and constructs. IDL is basically an attributed programming language and thus can describe parameters, functions and interfaces in a more precise and descriptive way than C.

    Do you “C” the application?

    Let’s start with an example so that we grasp the most essential concepts as we encounter them in the process. First we shall take up a simple program and then add to it the Client/Server functionality using RPC. This will let you see clearly the role RPC plays.

    // File NoRPC.cpp
    using namespace std;
    #include <iostream>

    // our would be server function.
    void Foo(const char* szMsg)
    {
    std::cout << szMsg << std::endl;
    }

    int main()
    {
    // There is no server
    // Call local
    Foo("I can’t RPC Foo!");
    }

    This small code fragment does nothing but print ‘I can’t RPC Foo!’ to the console window.

    More .NET Articles
    More By Digvijay Chauhan


       · Hi,I was able to compile the *.idl file. But I am getting an error while trying to...
       · i successfully compile the code...but when i running server program i got pop up...
       · First of all I would like to thank you for such wonderful articles on smart card and...
       · You may use the Smart Client like approach to execute Smart Card commands via the...
       · Its very kind of you to respond to my query. We were going through a office move and...
       · It's simple,a C# or J# script would do the job ...... only required thing is...
       · Hi DigvijayThanks very much for the response, but I am still struggling how to...
       · Hi,I believe i conveyed something wrong.What i meant was ........ after...
       · I am so sorry, this is my first ever attempt on .net and I am still not quite sure ...
       · First ..... You need not register the script if you have it running on the client...
       · I think I now understand whats happening.This is my latest codeprivate void...
       · Dear Friend,You've done it finally.Just enable Smart Clients on the client...
       · Hithanks for good article.I have some problem with MIDLhow I can get...
       · I am not able to compile the server code its stating that the function does not...
       · I am not able to compile the server code its stating that the function does not...
     

    .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 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek