Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Win32::Pipe as named pipe server for VMWare

by trickyhu (Initiate)
on Jun 25, 2013 at 01:15 UTC ( #1040507=perlquestion: print w/replies, xml ) Need Help??
trickyhu has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to create a named pipe server in perl that is compatible with a VMware workstation Named Pipe connection (made via a virtual serial port). When I have VMWare in the client mode and connect to my simple perl server using Win32::Pipe I get an error about the Named Pipe server not creating the pipe in an expected format. Doing some step through of the code for both the script to create the named pipe, which is a literal copy/paste at the moment from the source page, and the pm module Win32/ I think I have narrowed down where it the issue is. When Win32/ calls autoload for the const functions it does not seem to find a valid function for GetInfo. The only thing is I can't understand why it isn't a valid function. Looking at, where at this point I have literally copied and pasted the server code, I see GetInfo() as a valid function there. Server Code:

use Win32::Pipe; use strict; my $PipeName = "com2"; my $Pipe; $| = 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"; if( $Pipe->Connect() ) { my $In; my $User = ( $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" +; }

Win32/ function that fails on the function that the client (vmware) is attempting. $! is InvalidArgument and $constname = GetInfo

sub AUTOLOAD { # This AUTOLOAD is used to 'autoload' constants from the constant( +) # XS function. If a constant is not found then control is passed # to the AUTOLOAD in AutoLoader. my($constname); ($constname = $AUTOLOAD) =~ s/.*:://; #reset $! to zero to reset any current errors. local $! = 0; $val = constant($constname, @_ ? $_[0] : 0); if ($! != 0) { if ($! =~ /Invalid/) { $AutoLoader::AUTOLOAD = $AUTOLOAD; goto &AutoLoader::AUTOLOAD; } else { # Added by JOC 06-APR-96 # $pack = 0; $pack = 0; ($pack,$file,$line) = caller; print "Your vendor has not defined Win32::Pipe macro $cons +tname, used in $file at line $line."; } } eval "sub $AUTOLOAD { $val }"; goto &$AUTOLOAD; }

Any help would be greatly appreciated

Replies are listed 'Best First'.
Re: Win32::Pipe as named pipe server for VMWare
by BrowserUk (Pope) on Jun 25, 2013 at 01:38 UTC

    The method is just Info(), not GetInfo().

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1040507]
Approved by BrowserUk
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2018-01-18 00:27 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (206 votes). Check out past polls.