dallen16 has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Umm... Win32::Pipe
by jand (Friar) on Oct 08, 2008 at 00:45 UTC | |
|
Re: Umm... Win32::Pipe
by BrowserUk (Patriarch) on Oct 08, 2008 at 01:05 UTC | |
by jand (Friar) on Oct 08, 2008 at 01:36 UTC | |
by BrowserUk (Patriarch) on Oct 08, 2008 at 02:15 UTC | |
by Anonymous Monk on Nov 28, 2008 at 14:19 UTC | |
|
Re: Umm... Win32::Pipe
by Anonymous Monk on Oct 08, 2008 at 00:35 UTC | |
by dallen16 (Sexton) on Oct 08, 2008 at 00:53 UTC | |
by Anonymous Monk on Oct 08, 2008 at 02:02 UTC |