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.1 by elmex, Mon Aug 3 08:30:08 2009 UTC vs.
Revision 1.2 by elmex, Mon Aug 3 08:34:21 2009 UTC

349 349
350 AnyEvent->condvar->recv; 350 AnyEvent->condvar->recv;
351 351
352This is all. Looks much easier, doesn't it? I'll explain it only shortly, as 352This is all. Looks much easier, doesn't it? I'll explain it only shortly, as
353we had the discussion of the C<rcv> method in the client part of this tutorial 353we had the discussion of the C<rcv> method in the client part of this tutorial
354above.
355
356First this:
357
358 become_public "localhost:1299";
359
360This will tell our I<node> to become a I<public> node, which means that it can
361be contacted via TCP. The first argument should be the I<noderef> the server
362wants to be reachable at. In this case it's the TCP port 1299 on localhost.
363
354above. We bascially setup two receivers, one for the C<join> messages and 364Next we bascially setup two receivers, one for the C<join> messages and
355another one for the actual messages of type C<messsage>. 365another one for the actual messages of type C<messsage>.
356 366
357In the C<join> message we get the client's port, which we just remember in the 367In the C<join> message we get the client's port, which we just remember in the
358C<%client_ports> hash. In the receiver for the message type C<message> we will 368C<%client_ports> hash. In the receiver for the message type C<message> we will
359just iterate through all known C<%client_ports> and relay the message to them. 369just iterate through all known C<%client_ports> and relay the message to them.
370
371And thats it.
360 372
361=head2 The Remaining Problems 373=head2 The Remaining Problems
362 374
363The shown implementation still has some bugs. For instance: How does the 375The shown implementation still has some bugs. For instance: How does the
364server know that the client isn't there anymore, and can cleanup the 376server know that the client isn't there anymore, and can cleanup the

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines