Hello,
I have a question about using the Win32::pipe perl module.
I've taken the examples from The Official Win32::Pipe Home Page, http://www.roth.net/perl/pipe/ .
The scripts I'm using are pretty the same as in the examples and are included below.
The problem I'm having is the server process will connect to the pipe, but once it is disconnected, it
won't reconnect. The same applies to the client (unable to connect to the pipe a second time).
I'm hoping to get some suggestions on what I could do to get this to work.
I don't see anything in the forums with a similar questions and nothing jumped out at me on google.
I was wondering if anyone is getting similar results on XP.
Thanks for your suggestions.
Server and client are being run on the same system, Windows XP sp2, with perl version:
This is perl, v5.8.7 built for MSWin32-x86-multi-thread
Binary build 813 [148120] provided by ActiveState http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Jun 6 2005 13:36:37
my output:
server side:
V:\perl\pipe>pipeSrvRoth.pl
Creating pipe "My Named Pipe".
Waiting for a client to connect...
Client sent us: Time on MyComputer is: Thu May 11 13:22:41 2006
Disconnecting...
Waiting for a client to connect...
Waiting for a client to connect...
Waiting for a client to connect...
Waiting for a client to connect...
Waiting for a client to connect...
Waiting for a client to connect...
Waiting for a client to connect...
Waiting for a client to connect...
Waiting for a client to connect...
Waiting for a client to connect...
Waiting for a client to connect...
Waiting for a client to connect...
Waiting for a client to connect...
Terminating on signal SIGINT(2)
client side:
V:\perl\pipe>pipeClRoth.pl
Connecting to \\CurtLarson\pipe\My Named Pipe
Pipe has been opened, writing data to it...
V:\perl\pipe>pipeClRoth.pl
Connecting to \\CurtLarson\pipe\My Named Pipe
Error connecting: The operation completed successfully.
scripts
server
use strict;
use Win32::Pipe;
use Win32;
my $PipeName = "My Named Pipe";
my ($Pipe, $In);
$| = 1;
my $bServerContinue = 1;
print "Creating pipe \"$PipeName\".\n";
if( $Pipe = new Win32::Pipe( $PipeName ) )
{
while( $bServerContinue )
{
print "Waiting for a client to connect...\n";
sleep 3;
if( $Pipe->Connect() )
{
$In = $Pipe->Read();
print "Client sent us: $In\n";
print "Disconnecting...\n";
$Pipe->Disconnect();
}
}
$Pipe->Close();
}
else
{
print "\nCould not create pipe\n";
print "Error: " . Win32::FormatMessage( $Win32::Pipe::Error ) . "\n";
}
client
use strict;
use Win32::Pipe;
my ( $PipeName, $Pipe);
$PipeName = "\\\\MyComputer\\pipe\\My Named Pipe";
print "Connecting to $PipeName\n";
if( $Pipe = new Win32::Pipe( $PipeName ) )
{
my $Data = "" on " . Win32::NodeName() . " is: " . localtime() . "\n";
print "\nPipe has been opened, writing data to it...\n";
$Pipe->Write( $Data );
$Pipe->Close();
}
else
{
print "Error connecting: " . Win32::FormatMessage( $Win32::Pipe::Error ) . "\n";
}
[EMAIL PROTECTED]
IBM Global Services Unix & Intel Servers
Rochester PC Server Team
Tie Line: 253-7379 External: 507-253-7379
Dept LURF, Bldg 020-3/A315
_______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
