dascope has asked for the wisdom of the Perl Monks concerning the following question:
It returns the following output:----------------------------------------------------------- #!/usr/bin/perl -w use strict; use IO::Socket; my ($host, $port, $handle, $byte, $test); unless (@ARGV == 2) { die "usage: $0 host port" } ($host, $port) = @ARGV; $handle = IO::Socket::INET->new(Proto => "tcp", PeerAddr => $host, PeerPort => $port) or die "can't connect to port $port on $host: $!"; print "[Connected to $host:$port]\n"; print $handle "ETRN mydomain.com\nQUIT\n"; while (sysread($handle, $byte, 1) == 1) { print STDOUT $byte; } close $handle; -----------------------------------------------------------
[bashprompt] perl flush-queue.pl mail.server.com 25 [Connected to mail.server.com:25] 220 mail.server.com ESMTP (Mail Server); Wed, 4 Sep 2002 09:57:41 -040 +0 (EDT) 250 2.0.0 Queuing for node mydomain.com started 221 2.0.0 mail.server.com closing connection 220 mail.server.com ESMTP (Mail Server); Wed, 4 Sep 2002 09:57:41 -040 +0 (EDT) [bashprompt]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Socket output issue...
by dascope (Initiate) on Sep 04, 2002 at 14:15 UTC | |
by zentara (Cardinal) on Sep 04, 2002 at 16:18 UTC |