C++ RPC tutorial? [closed]

瘦欲@ 提交于 2019-12-02 19:43:00

Try this:

Overview

Technical Reference - also describes what it is & how it works

I would start with the Platform SDK samples on RPC.

  • ASYNCRPC illustrates the structure of an RPC application that uses asynchronous remote procedure calls. It also demonstrates various methods of notification of the call's completion.
  • CLUUID demonstrates use of the client-object UUID to enable a client to select from multiple implementations of a remote procedure.
  • DATA directory contains four programs:
    • DUNION illustrates discriminated (nonencapsulated) unions;
    • INOUT demonstrates [in], [out] parameters;
    • REPAS demonstrates the represent_as attribute;
    • XMIT demonstrates the transmit_as attribute.
  • DYNEPT demonstrates a client application managing its connection to the server through dynamic endpoints.
  • FILEREP directory contains four samples illustrating how developers can write a simple file replication service, a multi-user file replication service, a service supporting security features, and a service using RPC asynchronous pipes.
  • HANDLES directory contains three programs, AUTO, CXHNDL, USRDEF, which demonstrate auto_handle, [context_handle], and generic (user-defined) handles, respectively.
  • HELLO is a client/server implementation of "Hello, world."
  • PICKLE directory contains two programs:
    • PICKLP demonstrates data procedure serialization;
    • PICKLT demonstrates data type serialization; both programs use the [encode] and [decode] attributes.
  • PIPES demonstrates the use of the pipe-type constructor.
  • RPCSVC demonstrates the implementation of a service with RPC.
  • STROUT demonstrates how to allocate memory at a server for a two-dimensional object (an array of pointers) and pass it back to the client as an [out]-only parameter. The client then frees the memory. This technique allows the stub to call the server without knowing in advance how much data will be returned.

why do you want to learn "raw" RPC? there are many good higher level RPC implementations:

  1. CORBA implementations
  2. google's protocol buffers
  3. Thrift

You need to learn 3 different things probably:

  • The C++ programming language
  • RPC
  • Some C++ RPC library

RPC == "Remote Procedure Call"

Essentially, its the idea that communications between two endpoints is best modeled on the concept of those endpoints making logical function calls on each other. In general one side "publishes" an API in some way (for example, if your using SOAP, typically you'll have a file called a WSDL (pronounced wizdel) that enumerates the functions you respond to... a client will first download your WSDL and then make calls to your available API's)... These days, almost all of the available technologies will layer their specific protocols on top of HTTP (for example Web Services, UPnP, REST).. This generally means you're servers are implemented on top of web servers...

So, if all you need to implement is the client side, then you can probably use libcurl for all of your HTTP needs...

Jean Davy

Have a look to RCF, Deltavsoft_Link and CodeProject_Link

Main behavior is that RCF doesn't use a separate IDL (Interface Definition Language).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!