in reply to Re: Re: Tye, that does the job.
in thread How do I open a r/w named pipe as a file? *Should* be simple...

The OsFHandleOpen() part hasn't been exercised much at all so you can always try using ReadFile and WriteFile from that same module instead.

Please give me details in case it is something about the module that I can fix. I just tried to use OsFHandleOpen in Win2K and it didn't work. ):

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: Re3: Tye, that does the job.
by Coleoid (Sexton) on Mar 29, 2001 at 07:51 UTC
    > Please give me details in case it is something about the module that I can fix.

    Gads, I'd love to, but now I'm home, and you say it doesn't work in W2K, and it's trivial in unix... So I guess I'm sitting on my hands for the moment... *grin*

    However, in rough, I set up a couple of braindead pipe scripts (server and client) using the Win32::Pipe module first. Of course, it worked for that case. In fact, it works almost always on my dev box. When we try it on the server, Dr. Watson steps in.
    I've never managed to crash perl before...

    So I have the scripts talk to each other briefly. It works perversely well. I then replace the client pipe stuff with the Win32API::File code you showed me earlier. Now, when the client sends "garbage" to the server, the server reports that it got something like

    [garbage* ]
    Where the asterisk is actually a smiley-face extended character, and the brackets hint that there's at least one newline in the mess. I haven't done a character-by-character dump of the output yet.

    When the server responds to the client, the client shows only the smiley and newline, without the data I want.

    Sheesh. This is probably either (1) never before seen or (2) some Windows-specific peculiarity I should already have figured out...it has that feel.

    For completeness, I'm running AS build 620 on my dev box, NT4. The server was running 623/NT4. We downgraded the server to 620, no help.

Re: Re3: Tye, that does the job.
by Coleoid (Sexton) on Mar 29, 2001 at 23:51 UTC
    Update:

    I found version 20000216 of Win32::Pipe on roth.net, installed that, and now I'm able to do a vanilla perl file open, but it passes me the same sort of garbage the Win32API::File version was.

    I am trying to interpret this as good news for me, but I haven't succeeded yet...

    # Vanilla file implementation open( PIPE, "+<" . $PIPE_NAME ) || die "couldn't open pipe"; print PIPE "vanilla!\0"; my $result = <PIPE>; print "Server said [$result]\n"; foreach (split //, $result) { print "[" . (ord $_) . "]"; } print "\n"; close PIPE;
    Output of the two look like:
    Server read: [vanilla! { require $path; }; ] [118][97][110][105][108][108][97][33][0][123] [32][114][101][113][117][105][114][101][32][36] [112][97][116][104][59][32][125][59][13][13][10] and... Server said [{ require $path; }; ] [123][32][114][101][113][117][105][114][101] [32][36][112][97][116][104][59][32][125][59][13][10]
    (line breaks within the ord dumps inserted for clarity)

    Perhaps I'd just fumbled the open call, earlier, when I couldn't get the vanilla file version working.

    Clearly, though, I'm getting too many characters. The \0 at the end of my client send was pure desperation--sending a \n doesn't stop it correctly either.