So ... either I'm having a brain freeze in my old age... or Win32::Pipe doesn't work as it should (at least as I think it should). I get the same problem using ActiveState Perl 5.8.8 and 5.10 on WinXP and Win2K3...

On the server side, I believe the basic process is supposed to be open named pipe (once only), loop, wait for client connect (blocking), read (and write), disconnect, loop until break condition, after break condition, close pipe. Test server side code is as follows.

use strict; use warnings; use Win32::Pipe; my $jobPipe = new Win32::Pipe('jobPipe') || die "Can't Create Named Pi +pe 'jobPipe'\n"; while (1) { if (!$jobPipe->Connect()) { print "jobPipe connect failed\n"; last; } print "client connected\n"; my $line = ''; while (my $buf = $jobPipe->Read()) { $line .= $buf; } print "read '$line' from jobPipe\n"; $jobPipe->Disconnect(); last if (lc(substr($line,0,4)) eq 'exit'); } $jobPipe->Close(); exit(0);

So this works the first time through the loop but the second time "$jobPipe->Connect()" is called, it fails -- when it should wait (block) for another client to open the pipe (right?). Client side code follows.

use strict; use warnings; use Win32::Pipe; my $jobPipe = new Win32::Pipe("\\\\.\\PIPE\\jobPipe") or die "could no +t open jobPipe\n"; $jobPipe->Write("Dir *.pm\n"); $jobPipe->Close(); exit(0);

Many thanks in advance.

Dewey


In reply to Umm... Win32::Pipe by dallen16

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.