File: dns

package info (click to toggle)
libcoro-perl 5.210-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 752 kB
  • ctags: 367
  • sloc: perl: 1,992; ansic: 1,315; makefile: 2
file content (21 lines) | stat: -rwxr-xr-x 316 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl

use Coro;
use Coro::Util;
use Coro::AnyEvent;

use Socket;

# do some asynchronous hostname resolution

my @pid;

for my $x (1..255) {
   push @pid, async {
      my $addr = "129.13.162.$x";
      print "$addr => ",(scalar gethostbyaddr inet_aton($addr), AF_INET),"\n";
   };
}

$_->join for @pid;