コード例 #1
0
ファイル: IpcClient.cs プロジェクト: reyaleman/CSNamedPipes
    public static void ThreadProc(Object n)
    {
        Int32         index = (Int32)n;
        IpcClientPipe cli   = new IpcClientPipe(".", "ExamplePipeName");

        PipeStream pipe;

        try {
            pipe = cli.Connect(10);
        }
        catch (Exception e) {
            Console.WriteLine("Connection failed: " + e);
            return;
        }

        // Asynchronously send data to the server
        string message = "Test request " + index;

        Byte[] output = Encoding.UTF8.GetBytes(message);
        Debug.Assert(output.Length < IpcServer.SERVER_IN_BUFFER_SIZE);
        pipe.Write(output, 0, output.Length);

        // Read the result
        Byte[] data      = new Byte[IpcServer.SERVER_OUT_BUFFER_SIZE];
        Int32  bytesRead = pipe.Read(data, 0, data.Length);

        Console.WriteLine("Server response: " + Encoding.UTF8.GetString(data, 0, bytesRead));

        // Done with this one
        pipe.Close();
    }
コード例 #2
0
        public Client(string serverName, string name)
        {
            IpcClientPipe clientPipe = new IpcClientPipe(serverName, name);

            stream = clientPipe.Connect(1000);

            stream.BeginRead(header, 0, header.Length, OnRead, this);
        }
コード例 #3
0
ファイル: RpcClient.cs プロジェクト: ha11owed/RPC
        public RpcClient(IObjectMapper mapper, string serverName, string pipe)
        {
            client = new IpcClientPipe(serverName, "c" + pipe);
            //server = new IpcServer("s" + pipe, new RpcServerCallback(mapper), 1);

            var stream = client.Connect(1000);

            //stream.BeginRead(null, 0, 1, )
        }
コード例 #4
0
ファイル: Client.cs プロジェクト: ha11owed/RPC
        public Client(string serverName, string pipeName, string tag)
        {
            this.serverName = serverName;
            this.pipeName   = pipeName;
            this.tag        = tag;

            IpcClientPipe clientPipe = new IpcClientPipe(serverName, pipeName);

            stream = clientPipe.Connect(1000);
            //stream.BeginRead()
        }
コード例 #5
0
 public CallHandler(IObjectMapper mapper, string serverName, string serverToken)
 {
     this.mapper = mapper;
     client      = new IpcClientPipe(serverName, serverToken);
 }