ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/MP/Intro.pod
(Generate patch)

Comparing AnyEvent-MP/MP/Intro.pod (file contents):
Revision 1.57 by root, Fri Mar 23 01:57:43 2012 UTC vs.
Revision 1.58 by root, Fri Mar 23 21:16:25 2012 UTC

235 235
236First let's have a look at C<configure>: 236First let's have a look at C<configure>:
237 237
238 configure nodeid => "eg_receiver/%u", binds => ["*:4040"]; 238 configure nodeid => "eg_receiver/%u", binds => ["*:4040"];
239 239
240Before we are able to send messages to other nodes we have to initialise 240Before we are able to send messages to other nodes we have to configure
241ourself to become a "distributed node". Initialising a node means naming 241the node to become a "networked node". Configuring a node means naming
242the node and binding some TCP listeners so that other nodes can 242the node and binding some TCP listeners so that other nodes can contact
243contact it. 243it. The choice on whether a process becomes a networked node or not must
244be done before doing anything else with AnyEvent::MP.
244 245
245Additionally, to actually link all nodes in a network together, you can 246Additionally, to actually link all nodes in a network together, you should
246specify a number of seed addresses, which will be used by the node to 247specify a number of seed addresses, which will be used by the node to
247connect itself into an existing network, as we will see shortly. 248connect itself into an existing network, as we will see shortly.
248 249
249All of this (and more) can be passed to the C<configure> function - later 250All of this info (and more) can be passed to the C<configure> function -
250we will see how we can do all this without even passing anything to 251later we will see how we can do all this without even passing anything to
251C<configure>! 252C<configure>!
252 253
253The first parameter, C<nodeid>, specified the node ID (in this case 254Back to the function call in the program: the first parameter, C<nodeid>,
254C<eg_receiver/%u> - the default is to use the node name of the current 255specified the node ID (in this case C<eg_receiver/%u> - the default is to
255host plus C</%u>, which goves the node a name with a random suffix to 256use the node name of the current host plus C</%u>, which goves the node a
256make it unique, but for this example we want the node to have a bit more 257name with a random suffix to make it unique, but for this example we want
257personality, and name it C<eg_receiver> with a random suffix. 258the node to have a bit more personality, and name it C<eg_receiver> with a
259random suffix.
258 260
259Why the random suffix? Node IDs need to be unique within the network and 261Why the random suffix? Node IDs need to be unique within the network and
260appending a random suffix is the easiest way to do that. 262appending a random suffix is the easiest way to do that.
261 263
262The second parameter, C<binds>, specifies a list of C<address:port> pairs 264The second parameter, C<binds>, specifies a list of C<address:port> pairs

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines