
alto
New User
Feb 2, 2003, 8:59 AM
Post #1 of 3
(380 views)
|
|
Smtp Clien problem
|
Can't Post
|
|
I'm trying to write a small smtp client using IO:Socket. The problem is that sometime I Can connect to the SMTP server to port 25 but it doesn't return any response, Then my clien is wauiting for ever trying to read from the soket. Any ideas how to solve it? Code sample: unless($mx = new IO::Socket::INET( PeerAddr => $remote, PeerPort => 25, Proto => 'tcp', Timeout => 2)) { return -1; } unless (<$mx> =~ m/^220/) { # here the script is stuck if the server don't sent answer return -1; } print $mx "HELO D\r\n"; $f = <$mx>; print $f; unless ($f =~ m/^250/) { return -1; } : :
|