public static string ReceiveMsg(string serverName, string pipeName)
        {
            using (var client = new NamedPipeClientStream(serverName, pipeName,
                                                          PipeDirection.InOut, PipeOptions.None,
                                                          TokenImpersonationLevel.Impersonation))
            {
                client.Connect();

                var writer = new NamedPipeStreamWriter(client);
                writer.Write("GET data.xml");

                var reader = new NamedPipeStreamReader(client);
                return(reader.Read());
            }
        }
        public static void SendMsg(string pipeName, string msg)
        {
            using (var server = new NamedPipeServerStream(pipeName, PipeDirection.InOut))
            {
                server.WaitForConnection();

                var reader = new NamedPipeStreamReader(server);

                var clientsMsg = reader.Read();

                if (clientsMsg == "GET data.xml")
                {
                    var writer = new NamedPipeStreamWriter(server);

                    server.RunAsClient(() => { writer.Write(msg); });
                }
            }
        }