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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |