> -----Original Message-----
> From: perl-cgi [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 29, 2001 4:49 PM
> To: 'James Kelty'
> Cc: [EMAIL PROTECTED]
> Subject: RE: Perl script to monitor sendmail
> 
> 
> I am having problems with this. For some reason the script 
> connects even
> though nothing is listening on that port.
> 
> ie. If I shut down the smtp server I can no longer 'telnet 
> hostname 25'
> so the script should die, but it doesn't.
> 
> Here is what I have:
> 
> #!/usr/local/bin/perl -w
> 
> use IO::Socket::INET;
> 
> $remote_host    = "85.3.25.115";
> $remote_port    = 25;
> 
> my $sock = IO::Socket::INET->new(PeerAdd   => $remote_host,
>                                  PeerPort  => $remote_port,
>                                  Proto     => "tcp",
>                                  Type      => SOCK_STREAM,   # added
> this for testing, this has no effect either way
>                                  Timeout   => 10)
>         or die "Could not connect to 
> $remote_host:$remote_port : $@\n";
> 
> print $sock "HELO\n";
> $reply = <$sock>;
> print "$reply\n";
> 
> 
> Nothing is ever printed as well, however I am mainly interested in the
> script dying where it is supposed to. 
> 
> Any ideas?

You misspelled PeerAddr as PeerAdd.

Since PeerAddr is not being supplied, connect() is not being called.
Your socket is still being created, but it is assuming you are going
to call connect() yourself later, which you aren't doing.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to