Y
Yohan N. Leder
Hello. In the framework of a dialog with an ESMTP server, I would like
to alternate some incoming socket reading using <> (when server replies
with a single line) and sysread() (when server replies with several
lines), is there something to take care with this kind of alternance ?
Here a piece of typical part (without response codes checking) :
use Socket;
[here code to connect using two sockets : SOCKET_IN and SOCKET_OUT]
select(SOCKET_IN); $| = 1; select(SOCKET_OUT); $| = 1; select(STDOUT);
my $resp = <SOCKET_IN>; # wait server be ready
syswrite(SOCKET_OUT, "EHLO test\cM\cJ", 11); # engage dialog
sysread(SOCKET_IN, $resp, 1024); # fetch a multi-lines response
syswrite(SOCKET_OUT, "AUTH PLAIN\cM\cJ", 11); # engage authentication
$resp = <SOCKET_IN>; # wait server ask for username
[...]
to alternate some incoming socket reading using <> (when server replies
with a single line) and sysread() (when server replies with several
lines), is there something to take care with this kind of alternance ?
Here a piece of typical part (without response codes checking) :
use Socket;
[here code to connect using two sockets : SOCKET_IN and SOCKET_OUT]
select(SOCKET_IN); $| = 1; select(SOCKET_OUT); $| = 1; select(STDOUT);
my $resp = <SOCKET_IN>; # wait server be ready
syswrite(SOCKET_OUT, "EHLO test\cM\cJ", 11); # engage dialog
sysread(SOCKET_IN, $resp, 1024); # fetch a multi-lines response
syswrite(SOCKET_OUT, "AUTH PLAIN\cM\cJ", 11); # engage authentication
$resp = <SOCKET_IN>; # wait server ask for username
[...]