Skip to content

Commit

Permalink
update network/dns.pl and .github/CODE_OF_CONDUCT.md
Browse files Browse the repository at this point in the history
  • Loading branch information
htrgouvea committed Jun 16, 2018
1 parent cd8d1a6 commit 588fe70
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
File renamed without changes.
41 changes: 25 additions & 16 deletions network/dns.pl
Expand Up @@ -10,22 +10,31 @@
use Net::DNS;
use IO::Select;

my $timout = 5;
my $res = new Net::DNS::Resolver;
my $bgsock = $res -> bgsend ("heitorgouvea.me");
my $sel = IO::Select -> new ($bgsock);
my @ready = $sel -> can_read ();

if (@ready) {
foreach my $sock (@ready) {
if ($sock == $bgsock) {
my $packet = $res -> bgread ($bgsock);

$packet -> print;
$bgsock = undef;
}
sub main {
my $target = $ARGV[0];

if ($target) {
my $timout = 5;
my $res = new Net::DNS::Resolver;
my $bgsock = $res -> bgsend ($target);
my $sel = IO::Select -> new ($bgsock);
my @ready = $sel -> can_read ();

if (@ready) {
foreach my $sock (@ready) {
if ($sock == $bgsock) {
my $packet = $res -> bgread ($bgsock);

$sel -> remove($sock);
$sock = undef;
$packet -> print;
$bgsock = undef;
}

$sel -> remove($sock);
$sock = undef;
}
}
}
}

main();
exit;

0 comments on commit 588fe70

Please sign in to comment.