Hello,

I'm hoping someone can help me with an INET Socket question.  I have
the following socket setup and subroutine to receive data from a
Server:

# connection protocol
if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
die "No port" unless $port;
$iaddr = inet_aton($remote)               or die "no host: $remote";
my $paddr = sockaddr_in($port, $iaddr);

$proto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
connect(SOCK, $paddr)                      or die "connect: $!";

# Client subroutine
sub receiveServerResponse() {
    my $line = "";
    while ($line = <SOCK>) {
        if ($line) {
            print "\tReceived: $line";
            return $line;
        }
    }
}

The protocol I am following insists on having a LF at the end of all
messages, but some (Windows-based) servers with whom I am attempting
to cooperate are incorrectly sending messages ending with CR.  How can
I get 

        while ($line = <SOCK>)

to recognize a "line" ending with CR?

Thanks for any help,
Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to