[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Anyone...?



As a followup, both of these work for me (the second has no error handling, but
you get the idea):

#!perl

use Socket;
$serv = "leprss.gsfc.nasa.gov";

socket(Seraph, PF_INET, SOCK_STREAM, 6);

$sin = sockaddr_in("25",inet_aton("$serv"));
$conn = connect(Seraph,$sin);
select((select(Seraph),$| = 1)[0]);
die "Connection couldn't be made. $!" if ($conn != 1);
$msg = <Seraph>;
print "$msg";
if ($msg !~ /^220/) {die "Host not responding correctly.";}
print Seraph "EHLO\015\012";
$msg = <Seraph>;
print "$msg";
close(Seraph);


#!perl

use IO::Socket;

$sock = IO::Socket::INET->new(PeerAddr => "leprss.gsfc.nasa.gov",
                              PeerPort => 25,Proto => 'tcp');
$sock->autoflush(1);
print $sock->getline;
$sock->print("EHLO\015\012");
print $sock->getline;
$sock->close;

---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch