[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-win32-admin
Subject:    Problem with Win32::Pipe
From:       Black Pearl <pearl () shelob ! demon ! nl>
Date:       2000-07-31 20:42:55
[Download RAW message or body]


Output of server:
Creating pipe "TestPipe".
Argument "DEFAULT_WAIT_TIME" isn't numeric in subroutine entry at
D:/Perl/site/lib/Win32/Pipe.pm line 45.
Waiting for a client to connect...
Can't locate auto/Win32/Pipe/GetInfo.al in @INC (@INC contains:
D:/Perl/lib D:/Perl/site/lib .) at D:\scripts\pipesrv2.pl line 36
 
The last part (starting with Can't locate ...) is after a connection
is attempted by the client. Then the server fails.

What can be wrong here?

See below for some more info.

TIA,

Hans Feringa


This are the code parts (example taken from an information web
document about the subject).

Server:

# Server code
use Win32::Pipe;

$PipeName = "TestPipe";
$| = 1;

my $bServerContinue = 1;
print "Creating pipe \"$PipeName\".\n";

# If you have Win32::Perms you could create a Win32::Perms object and
# specify it when creating the pipe...
# use Win32::Perms
# $Perm = new Win32::Perms() || die "Unable to create a security
descriptor.\n";
# $Perm->Allow( "Marketing\\JOEL", FULL );
# $Perm->Allow( "administrator", FULL );
# $Perm->Owner( "Tech\\BILLY" );
#
# Now create the pipe and specify to use the permissions above
# if( $Pipe = new Win32::Pipe( $PipeName, DEFAULT_WAIT_TIME,
PIPE_READMODE_BYTE, $Perm ) )
#

if( $Pipe = new Win32::Pipe( $PipeName ) )
{
  while( $bServerContinue )
  {
    print "Waiting for a client to connect...\n";

    if( $Pipe->Connect() )
    {
      my $In;

      $User = ( $Pipe->GetInfo() )[2];
      my @PipeInfo = ( $Pipe->GetInfo() )[2];
      print "Pipe opened by $User.\n";

      $In = $Pipe->Read();

      print "Client sent us: $In";

      print "Disconnecting...\n";
      $Pipe->Disconnect();
    }
  }
  $Pipe->Close();
}
else
{
  print "\nCould not create pipe\n";
  print "Error: " . Win32::FormatMessage( $Win32::Pipe::Error ) . "\n";
}


Client:
# Client code
use Win32::Pipe;

$PipeName = "\\\\nnma1107\\pipe\\TestPipe";
print "Connecting to $PipeName\n";

if( $Pipe = new Win32::Pipe( $PipeName ) )
{
  my $Data = "Time 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";
}





_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic