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

Comparing Coro/eg/dns (file contents):
Revision 1.2 by root, Mon Sep 3 02:50:18 2001 UTC vs.
Revision 1.3 by root, Sat Apr 14 15:06:06 2007 UTC

6 6
7use Socket; 7use Socket;
8 8
9# do some asynchronous hostname resolution 9# do some asynchronous hostname resolution
10 10
11async { 11async { loop }; # run the Event loop as a separate coroutine
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}; 13my @pid;
21 14
22loop; 15for my $x (1..255) {
16 push @pid, async {
17 my $addr = "129.13.162.$x";
18 print "$addr => ",(scalar gethostbyaddr inet_aton($addr), AF_INET),"\n";
19 };
20}
21
22$_->join for @pid;
23

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines