Carriage Returns and sockets

I

Iceberg

Hi, I'm using ActivePerl on Win98 and this is starting to annoy me.
Why isn't \n accepted as a carriage return when I'm using sockets?
If I run the following program, I get no response other than the SMTP info
header. Using a proxy to investigate, I found that what is getting sent to
the server is only an 0a character not an 0d0a sequence, any help on this
would be great appreciated. I've already tried sending \r\n and that makes
no difference.

#!/usr/bin/perl -w
use IO::Socket;
$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "smtp_host",
PeerPort => "25",
)
or die "cannot connect to server";
# get SMTP server welcome
$line=<$remote>;
print "$line\n";

# send HELO
print $remote "HELO\n"; # the \n here doesn't seem to work

# get reply
$line=<$remote>;
print "$line\n";
 
I

Iceberg

Just found out the solution:
$EOL = "\015\012";
print $remote "HELO".$EOL;

but does anybody know any easier way?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top