… | |
… | |
21 | snd $port, type => data...; |
21 | snd $port, type => data...; |
22 | snd $port, @msg; |
22 | snd $port, @msg; |
23 | snd @msg_with_first_element_being_a_port; |
23 | snd @msg_with_first_element_being_a_port; |
24 | |
24 | |
25 | # creating/using ports, the simple way |
25 | # creating/using ports, the simple way |
26 | my $simple_port = port { my @msg = @_; 0 }; |
26 | my $simple_port = port { my @msg = @_ }; |
27 | |
27 | |
28 | # creating/using ports, tagged message matching |
28 | # creating/using ports, tagged message matching |
29 | my $port = port; |
29 | my $port = port; |
30 | rcv $port, ping => sub { snd $_[0], "pong"; 0 }; |
30 | rcv $port, ping => sub { snd $_[0], "pong" }; |
31 | rcv $port, pong => sub { warn "pong received\n"; 0 }; |
31 | rcv $port, pong => sub { warn "pong received\n" }; |
32 | |
32 | |
33 | # create a port on another node |
33 | # create a port on another node |
34 | my $port = spawn $node, $initfunc, @initdata; |
34 | my $port = spawn $node, $initfunc, @initdata; |
35 | |
35 | |
36 | # monitoring |
36 | # monitoring |
… | |
… | |
231 | Example: configure a node using a profile called seed, which si suitable |
231 | Example: configure a node using a profile called seed, which si suitable |
232 | for a seed node as it binds on all local addresses on a fixed port (4040, |
232 | for a seed node as it binds on all local addresses on a fixed port (4040, |
233 | customary for aemp). |
233 | customary for aemp). |
234 | |
234 | |
235 | # use the aemp commandline utility |
235 | # use the aemp commandline utility |
236 | # aemp profile seed setnodeid anon/ setbinds '*:4040' |
236 | # aemp profile seed nodeid anon/ binds '*:4040' |
237 | |
237 | |
238 | # then use it |
238 | # then use it |
239 | configure profile => "seed"; |
239 | configure profile => "seed"; |
240 | |
240 | |
241 | # or simply use aemp from the shell again: |
241 | # or simply use aemp from the shell again: |