This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

rpc_00

This article describes the data/samples/syncker/rpc_00.cpp sample.

The rpc_00 sample demonstrates how to:

  • Call a remote procedure on all slaves from the world script running on the master side.
  • Operate with a value received from the remote procedure.

Notice
You need to open the console on the master and slave computers to see the sample output. Press the grave accent (`) key placed under the ESC key to call the console.

Remote procedure call (RPC) is initiated by the master, which tells the slaves to execute the specified procedure. The remote procedure call usually requires when some event (e.g. calculation) occurs on the master and you need to tell the slaves what to render according to this event.

The remote procedure is defined in the world script running on the slave side. It prints the received value in the console and returns the hello from slave string.

Source code (UnigineScript)
int rpc_function(int value) {
	log.message("Argument from master: %s\n",typeinfo(value));
	return "hello from slave";
}

In the master world script, the hello from master string is passed to the procedure.

Source code (UnigineScript)
Unigine::Syncker::Master::worldCall(~0,"rpc_function",("hello from master"),ret);
So, on all of the slaves the following message is printed in the console:
Source code
Argument from master: string: "hello from master"
The value received from the remote procedure appears in the console on the master side as follows:
Source code
Result from "xxx.xxx.xxx.xxx": string: "hello from slave"

See Also

Last update: 03.07.2017
Build: ()