RemoteProc
Constructor
RemoteProc <id> (string "ip", int port)
Action
Creates a connection to the remote subtree of components exported by a ProcExporter. Any child of the exported subtree is reachable as if it were a local node.Predefined children
- BoolProperty:
status
. True if successfully connected to the specifed address, false otherwise. - Spike:
connect
. Triggers a reconnection attempt to the specified address.
Cookbook recipe
directory:smala/cookbook/comms/
client
run :
make client_test
Example
use core
use base
use gui
use comms
_main_
Component root {
Frame f ("RemoteProc - client", 100, 100, 400, 300)
Exit ex (0, 1)
f.close -> ex
FillColor _ (#101010)
NoOutline _
Rectangle bkg (0, 0, 0, 0, 0, 0)
f.{width, height} =:> bkg.{width, height}
Translation _ (0, 75)
RemoteProc dp ("127.0.0.1", 8080)
Component sub {
FillColor fc (#FF0000)
Circle c (50, 50, 20)
c.press->dp.connect
Switch set_col (false) {
Component true {
#10FF10 =: fc.value
}
Component false {
#FF0000 =: fc.value
}
}
dp.status =:> set_col.state
}
FillColor _ (White)
Text t_inc (50, 100, "")
FillColor _ (100, 100, 250)
Rectangle r (100, 30, 40, 40, 5, 5)
r.press -> dp.inc
dp.inc.state =:> t_inc.text
FillColor _ (254, 200, 50)
Rectangle r2 (250, 30, 100, 100, 5, 5)
r2.move.x - 250 => dp.c.cx
r2.move.y - 70 => dp.c.cy
}