Home

mlamp

Download project

RPC Example

An example project for "Remote Procedure Calls". Two applications
demonstrate the implementation of server and client RPC applications.

Product description

The example is based on the library RPC which is part of the CODESYS Development System.
The library contains all required components for building RPC applications.
The example project RPCExample.project shows the usage of this library on the basis
of a simple client and server application.

More information

The project RPCExample.project includes the applications RPClient and RPCServer.
Both applications must run on separate devices.

RPC Client

The program PROG executes four remote procedure calls on the server:

  • HelloServerRequest
  • GetTargetId
  • GetTargetNodeName
  • GetTargetVersion

Each call is handled by the function block RPCRequest which uses the function block RPC.CLClient
to send an RPC request to the server. The results of the request are copied to the corresponding variables
in the method InvokeCallback of the function block RPCClientCallback. The request status and the
result of the request are displayed in visualization.

Visualization

At first, the IP address of the server must be entered in the field "Server IP".
After that the RPC request can be started via the button "RPC Request".

RPC Server

The program PLC_PRG initializes the function block RPC.CLServer and registers the interface
IRPCProvider. A procedure is described by objectId, interfaceId and operationnumber.
The request and the callback function are handled by operationnumber in the method Request.
The callback function can also be executed asynchronously in the next cycle.
The server component of the RPC library includes three standard procedures with device information by
default (Target Name, Target ID, Target Version).

System requirements and restrictions

System requirements and restrictions Info
Programming System CODESYS Development System Version 3.5.14.0 or higher
Runtime System CODESYS Control Version 3.5.14.0
Required Accessories -

Screenshot thumbnail
Screenshot of Visualization