ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/eg/dns
(Generate patch)

Comparing Coro/eg/dns (file contents):
Revision 1.1 by root, Sat Jul 28 01:41:58 2001 UTC vs.
Revision 1.4 by root, Mon Nov 24 04:56:38 2008 UTC

1#!/usr/bin/perl 1#!/usr/bin/perl
2 2
3use Coro; 3use Coro;
4use Coro::Event;
5use Coro::Util; 4use Coro::Util;
5use Coro::AnyEvent;
6 6
7use Socket; 7use Socket;
8 8
9# do some asynchroneous hostname resolution 9# do some asynchronous hostname resolution
10 10
11async { 11my @pid;
12 for my $x (1..255) {
13 use Data::Dumper;
14 async {
15 my $addr = "129.13.162.$x";
16 print "$addr => ",(scalar gethostbyaddr inet_aton($addr), AF_INET),"\n";
17 };
18 }
19 12
20}; 13for my $x (1..255) {
14 push @pid, async {
15 my $addr = "129.13.162.$x";
16 print "$addr => ",(scalar gethostbyaddr inet_aton($addr), AF_INET),"\n";
17 };
18}
21 19
22loop; 20$_->join for @pid;
21

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines