Results 1 to 16 of 16

Thread: [VB6] PipeRPC - RPC Over Named Pipes

Threaded View

  1. #12
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    591

    Re: [VB6] PipeRPC - RPC Over Named Pipes

    hi i need to get output from ipc pipe.i have a software document with these contents :

    .
    .
    .
    Unfortunately, it's not as easy to test the IPC protocol on Windows, since Windows ports of socat (in
    Cygwin and MSYS2) don't understand named pipes. In the absence of a simple tool to send and receive
    from bidirectional pipes, the echo command can be used to send commands, but not receive replies from
    the command prompt
    .

    You can send commands from a command prompt :
    Code:
    echo commands >\\.\pipe\mypipename
    To be able to simultaneously read and write from the IPC pipe, like on Linux, it's necessary to write an
    external program that uses overlapped file I/O
    (or some wrapper like .NET's NamedPipeClientStream.)

    You can open the pipe in PuTTY as "serial" device. This is not very comfortable, but gives a way to test
    interactively without having to write code
    and NamedPipeClientStream sample is :
    Code:
    using System;
    using System.IO;
    using System.IO.Pipes;
    
    class PipeClient
    {
        static void Main(string[] args)
        {
            using (NamedPipeClientStream pipeClient =
                new NamedPipeClientStream(".", "testpipe", PipeDirection.In))
            {
    
                // Connect to the pipe or wait until the pipe is available.
                Console.Write("Attempting to connect to pipe...");
                pipeClient.Connect();
    
                Console.WriteLine("Connected to pipe.");
                Console.WriteLine("There are currently {0} pipe server instances open.",
                   pipeClient.NumberOfServerInstances);
                using (StreamReader sr = new StreamReader(pipeClient))
                {
                    // Display the read text to the console
                    string temp;
                    while ((temp = sr.ReadLine()) != null)
                    {
                        Console.WriteLine("Received from server: {0}", temp);
                    }
                }
            }
            Console.Write("Press Enter to continue...");
            Console.ReadLine();
        }
    }
    Unfortunately, although I tested many examples in the forum, I still could not get the output from
    Code:
    echo commands >\\.\pipe\mypipename
    for example this command in linux :
    Code:
    echo '{ "command": ["aa", "bb"] }' | socat - /mypipename
    get result :
    Code:
    {"data":xxxxxx,"error":"success"}
    but with convert to pipe in widnows :
    Code:
    echo { "command": ["aa", "bb"] } >\\.\pipe\mypipename
    return hidden data like as empty the only way need connect to that \\.\pipe\mypipename and stream output data

    I also tested your attachment and it did not work, how could I get the output?
    Last edited by Black_Storm; Apr 9th, 2022 at 04:16 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width