From: loi huynh <lhuynh () newscorp ! com ! au>
To: tru64-unix-managers
Subject: Perl 5.002 socket call on DEC OSF/1 - HELP
Date: Wed, 21 May 1997 09:51:03 +0000 [thread overview]
Message-ID: <96078612210504.tru64-unix-managers.marc@archive.invalid> (raw)
Hi All,
I am running Perl 5.002 on a DEC 2100 with OSF/1 v3.2. I compiled Perl
successfully using DEC C and ran h2ph without any error. However
something didn't seem right when I use socket call to try the
client/server sample below.
I got the following message for both the server and the client but line
3 in my Perl code is a blank line for both the client and the server.
I don't know what is happenning here. Have I missed out something in
the h2ph conversion process? Any help are greatly appreciated.
Sincerely,
Loi Huynh.
This is the MESSAGE:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Scalar found where operator expected at (eval 58) line 3, near "*($p"
(Missing operator before $p?)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Here is the sample SERVER:
#!/usr/bin/perl -w
require 'sys/socket.ph';
$port = 7011;
$sockaddr = 'S n a4 x8';
($name, $aliases, $proto) = getprotobyname('tcp');
($name, $aliases, $port) = getservbyname($port, 'tcp') unless $port =~
/^\d+$/;
$this = pack($sockaddr, &AF_INET, $port, "\0\0\0\0");
socket(S, &PF_INET, &SOCK_STREAM, $proto) || die "socket: $!";
bind(S, $this) || die "bind: $!";
listen(S, 5) || die "connect: $!";
select(S);
$| = 1;
select(STDOUT);
for (;;) {
print "Listening again\n";
accept(NS,S) || die $!;
($addr = accept(NS,S)) || die $!;
print "accept ok\n";
($af,$port,$inetaddr) = unpack($sockaddr,$addr);
@inetaddr = unpack('C4',$inetaddr);
print "$af $port @inetaddr\n";
while (<NS>) {
print;
}
}
Here is the sample CLIENT:
#!/usr/bin/perl
($them,$port) = @ARGV;
$port = 7011 unless $port;
$them = 'localhost' unless $them;
require 'sys/socket.ph';
$sockaddr = 'S n a4 x8';
chop($hostname = `hostname`);
($name, $aliases, $proto) = getprotobyname('tcp');
($name, $aliases, $port) = getservbyname($port, 'tcp')
unless $port =~ /^\d+$/;
($name, $aliases, $type, $len, $thisaddr) =
gethostbyname($hostname);
($name, $aliases, $type, $len, $thataddr) = gethostbyname($them);
$this = pack($sockaddr, &AF_INET, 0, $thisaddr);
$that = pack($sockaddr, &AF_INET, $port, $thataddr);
socket(S, &PF_INET, &SOCK_STREAM, $proto) || die "socket: $!";
bind(S, $this) || die "bind: $!";
connect(S, $that) || die "connect: $!";
select(S);
$| = 1;
select(STDOUT);
while (<STDIN>) {
print S;
}
--
~~~~~~~~~~~~~~~~~~~~~~o~0~o~~~~~~~~~~~~~~~~~~~~~~~
News Interactive (PH)+61-2-9288-3635
2 Holt Street Surry Hills (FX)+61-2-9288-3171
NSW Australia 2010 http://www.ni.com.au
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
reply other threads:[~1997-05-21 9:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox