This uses Unix domain sockets, it's from the perlipc manpage. you didn't specify what you were looking for
#!/usr/bin/perl -w # The client use Socket; use strict; my ($socky, $line); $socky = shift || '/tmp/mysock'; socket(SOCK, PF_UNIX, SOCK_STREAM, 0) || die "socket: $!"; connect(SOCK, sockaddr_un($socky)) || die "connect: $!"; while (defined($line = <SOCK>)) { print $line; } exit; ################# #!/usr/bin/perl -wT # The server use Socket; use strict; use Carp; BEGIN { $ENV{PATH} = '/usr/ucb:/bin'; } sub logit { print "$0 $$: @_ at ", scalar localtime, "\n"; } my $NAME = '/tmp/mysock'; my $uaddr = sockaddr_un($NAME); my $proto = getprotobyname('tcp'); socket(Server,PF_UNIX,SOCK_STREAM,0) || die "socket: $!"; unlink($NAME); bind (Server, $uaddr) || die "bind: $!"; listen(Server,SOMAXCONN) || die "listen: $!"; logit "server started on $NAME"; my $waitedpid; sub REAPER { $waitedpid = wait; $SIG{CHLD} = \&REAPER; logit "reaped $waitedpid" . ($? ? " with exit $?" : ''); } $SIG{CHLD} = \&REAPER; for ($waitedpid = 0; accept(Client,Server) || $waitedpid; $waitedpid = 0, close Client) { next if $waitedpid; logit "connection on $NAME"; spawn sub { print "Hello there, it's now ", scalar localtime, "\n"; exec '/usr/games/fortune' or die "can't exec fortune: +$!"; }; }

In reply to Re: Single-machine IPC via sockets and other things to say in the dark by BastardOperator
in thread "Single-machine IPC via sockets" and other things to say in the dark by Hot Pastrami

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.