Mailing List Archive

Re: Far More Than Everything You Ever Wanted to Know about Perl IPC
Excellent. You missed out communication by way of plain files :-)

Here's a few comments:

> And here's a corresponding server to go along with it. We'll
> leave the address empty (C<"\0" x 4>) so that the kernel can choose
> the appropriate interface on multihomed hosts:

Its not an empty address. Its a specific address called INADDR_ANY
(its in the new Socket.pm) which specifies that the kernel
should use _all_ interfaces on single/multihomed hosts.


> = sockaddr_in(0, ); # 0 means let kernel pick
>
> socket(SOCKET, PF_INET, SOCK_DGRAM, ) || die "socket: ";
> bind(SOCKET, ) || die "bind: ";

The bind is not necessary. The port is allocated automatically
anyway (I think as soon as you do a 'send' for udp sockets).


> =head1 WARNING
>
> The SysV IPC code was written long ago, and is definitely clunky
> looking. It should at the very least be made to C<use strict> and
> C<require "sys/ipc.ph">. Better yet, someone should create an C<IPC::SysV>
> module the way we have the C<Socket> module for normal client-server
> communications.

Someone has. Its been around for a while now. I never took it out of
alpha because of lack of feedback. Should be available at least
at
ftp://ftp.icnet.uk/icrf-public/biu/perlmods/IPC_SysV.tar.gz
and probably at your local CPAN store.

-- Jack Shirazi, JackS@slc.com
Re: Far More Than Everything You Ever Wanted to Know about Perl IPC [ In reply to ]
>Its not an empty address. Its a specific address called INADDR_ANY
>(its in the new Socket.pm) which specifies that the kernel
>should use _all_ interfaces on single/multihomed hosts.

Sigh. You wouldn't believe the problems I've been having
with that. My SunOS system keeps choosing the "wrong"
(internal, private) net to fill in, so it never comes back
ot me.

Will look at IPC_SysV and update later today. Right now it
times out.

--tom
Re: Far More Than Everything You Ever Wanted to Know about Perl IPC [ In reply to ]
> Someone has. Its been around for a while now. I never took it out of
> alpha because of lack of feedback. Should be available at least
> at
> ftp://ftp.icnet.uk/icrf-public/biu/perlmods/IPC_SysV.tar.gz
> and probably at your local CPAN store.

One enhancement request is to let us call the ftok() routine.

It would be even better if the XS code for these suckers checked to see if
you passed a string (filename) in, and call ftok automagically.

Jeff
Re: Far More Than Everything You Ever Wanted to Know about Perl IPC [ In reply to ]
> > It would be even better if the XS code for these suckers checked to see if
> > you passed a string (filename) in, and call ftok automagically.
>
> Provide ftok(), but don't make it automatic. Please.

Okay, that's fine with me. Just thought I'd try to save the programmer a step.

Jeff
Re: Far More Than Everything You Ever Wanted to Know about Perl IPC [ In reply to ]
According to Jeff Okamoto:
> It would be even better if the XS code for these suckers checked to see if
> you passed a string (filename) in, and call ftok automagically.

I'd recommend against automatic ftok() calls.

First, ftok() is a hack. It ass_u_mes that IPC keys will be based on
identities of filesystem objects, and there's no basis for that
assumption.

Second, if I fail to pass in a valid key, when I meant to pass in a
number, I'd greatly prefer that the module give me a warning instead
of silently doing something "clever".

Provide ftok(), but don't make it automatic. Please.
--
Chip Salzenberg, aka <chs@nando.net>
"Hey, it's the Miss Alternate Universe Pageant!"
-- Crow T. Robot, MST3K: "Stranded In Space"