Hi,
I'm getting an error when I run it.
Address not available. at line -> bind(S, $this) || die $!;
I don't understand why. Maybe someone could shed some light on it for me.
I am not familiar with writing perl. If anything else looks weard, I welcome any
and all comments. I could send this as an attachment if it doesn't email ok
but I didn't know if this list accepts attachments.
Thank you very much.
Gary Kuznitz
Perl Version 5.003
#!/usr/bin/perl
#########################################
#
# Perl implementation of DYNDNS.COM's NamedControl Client.
#
# by Gunnar Hellekson <[EMAIL PROTECTED]> 11/2/96
#
# based (heavily) on p.342 of the 1st Camel book
#
#########################################
($ip, $user, $pass, $domain) = @ARGV;
$AF_INET = 2;
$SOCK_STREAM = 1;
$SIG{'INT'} = 'dokill';
sub dokill {
kill 9,$child if $child;
}
$sockaddr = "S n a4 x8";
$user = "username" unless $user;
$pass = "password" unless $pass;
$domain = "dyndns.com" unless $domain;
$info = pack("a20", $user) . pack("a20", $pass) . pack("a16", $ip) .
pack("a64", $domain);
($name, $aliases, $proto) = getprotobyname('tcp');
($name, $aliases, $port) = getservbyname(50, 'tcp') unless $port =~
/^d+$/;
($name, $aliases, $type, $len, $thisaddr) =
gethostbyname(chop($hostname = "atu1277.com"));
($name, $aliases, $type, $len, $thataddr) = gethostbyname("dyndns.com");
$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, 50, $thataddr);
socket(S, $AF_INET, $SOCK_STREAM, $proto) || die $!;
bind(S, $this) || die $!;
connect(S,$that) || die $!;
select(S); $| = 1; select(STDOUT);
if ($child = fork) {
print "Waiting for routing tables to update...\n";
sleep 10;
print S $info;
sleep 3;
do dokill();
}
else {
while (<S>) {
printf("%s", $_);
}
print;
}