… | |
… | |
528 | It works by connecting to the finger port on another host, writing a |
528 | It works by connecting to the finger port on another host, writing a |
529 | single line with a user name and then reading the finger response, as |
529 | single line with a user name and then reading the finger response, as |
530 | specified by that user. OK, RFC 1288 specifies a vastly more complex |
530 | specified by that user. OK, RFC 1288 specifies a vastly more complex |
531 | protocol, but it basically boils down to this: |
531 | protocol, 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 | |
541 | So let's write a little AnyEvent function that makes a finger request: |
544 | So 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; |
… | |
… | |
731 | ignored IPv6 and a few other things that C<tcp_connect> handles for us. |
734 | ignored IPv6 and a few other things that C<tcp_connect> handles for us. |
732 | |
735 | |
733 | But the main advantage is that we can not only run this finger function in |
736 | But the main advantage is that we can not only run this finger function in |
734 | the background, we even can run multiple sessions in parallel, like this: |
737 | the 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 | |