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

Comparing AnyEvent/lib/AnyEvent/Intro.pod (file contents):
Revision 1.31 by root, Thu Sep 1 22:09:26 2011 UTC vs.
Revision 1.32 by root, Thu Mar 21 15:40:09 2013 UTC

528It works by connecting to the finger port on another host, writing a 528It works by connecting to the finger port on another host, writing a
529single line with a user name and then reading the finger response, as 529single line with a user name and then reading the finger response, as
530specified by that user. OK, RFC 1288 specifies a vastly more complex 530specified by that user. OK, RFC 1288 specifies a vastly more complex
531protocol, but it basically boils down to this: 531protocol, but it basically boils down to this:
532 532
533 # telnet kernel.org finger 533 # telnet freebsd.org finger
534 Trying 204.152.191.37... 534 Trying 8.8.178.135...
535 Connected to kernel.org (204.152.191.37). 535 Connected to freebsd.org (8.8.178.135).
536 Escape character is '^]'. 536 Escape character is '^]'.
537 537 larry
538 The latest stable version of the Linux kernel is: [...] 538 Login: lile Name: Larry Lile
539 Connection closed by foreign host. 539 Directory: /home/lile Shell: /usr/local/bin/bash
540 No Mail.
541 Mail forwarded to: lile@stdio.com
542 No Plan.
540 543
541So let's write a little AnyEvent function that makes a finger request: 544So let's write a little AnyEvent function that makes a finger request:
542 545
543 use AnyEvent; 546 use AnyEvent;
544 use AnyEvent::Socket; 547 use AnyEvent::Socket;
731ignored IPv6 and a few other things that C<tcp_connect> handles for us. 734ignored IPv6 and a few other things that C<tcp_connect> handles for us.
732 735
733But the main advantage is that we can not only run this finger function in 736But the main advantage is that we can not only run this finger function in
734the background, we even can run multiple sessions in parallel, like this: 737the background, we even can run multiple sessions in parallel, like this:
735 738
736 my $f1 = finger "trouble", "noc.dfn.de"; # check for trouble tickets 739 my $f1 = finger "kuriyama", "freebsd.org";
737 my $f2 = finger "1736" , "noc.dfn.de"; # fetch ticket 1736 740 my $f2 = finger "thierry" , "freebsd.org";
738 my $f3 = finger "hpa" , "kernel.org"; # finger hpa 741 my $f3 = finger "larry" , "freebsd.org";
739 742
740 print "trouble tickets:\n" , $f1->recv, "\n"; 743 print "trouble tickets:\n" , $f1->recv, "\n";
741 print "trouble ticket #1736:\n", $f2->recv, "\n"; 744 print "trouble ticket #1736:\n", $f2->recv, "\n";
742 print "kernel release info: " , $f3->recv, "\n"; 745 print "kernel release info: " , $f3->recv, "\n";
743 746

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines