当前位置: 首页>>代码示例>>C#>>正文


C# NamedPipeServerStream.GetHashCode方法代码示例

本文整理汇总了C#中System.IO.Pipes.NamedPipeServerStream.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# NamedPipeServerStream.GetHashCode方法的具体用法?C# NamedPipeServerStream.GetHashCode怎么用?C# NamedPipeServerStream.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.Pipes.NamedPipeServerStream的用法示例。


在下文中一共展示了NamedPipeServerStream.GetHashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            // Create a name pipe
            NamedPipeServerStream pipeStream = null;
            try
            {
                pipeStream = new NamedPipeServerStream(LogManager.ConnectionName, PipeDirection.InOut, 1, PipeTransmissionMode.Message);
                Console.WriteLine("Log Monitor started: " + pipeStream.GetHashCode());

                // Wait for a connection
                pipeStream.WaitForConnection();
                Console.WriteLine("Connection established");

                using (StreamReader sr = new StreamReader(pipeStream))
                {
                    pipeStream = null;

                    string temp;
                    // We read a line from the pipe and print it together with the current time
                    while ((temp = sr.ReadLine()) != null)
                    {
                        Console.WriteLine(temp);
                    }
                }
            }
            finally
            {
                if (pipeStream != null)
                {
                    pipeStream.Dispose();
                }
            }

            Console.WriteLine("Connection lost");
            Console.WriteLine("Press <ENTER> to quit");
            Console.ReadLine();
        }
开发者ID:dhanzhang,项目名称:Windows-classic-samples,代码行数:37,代码来源:Program.cs

示例2: createNamePipeServer

 public static NamedPipeServerStream createNamePipeServer(string pipeName, Action<string> dataReceived, Action onPipeTerminated)
 {
     var namedPipeServerStream = new NamedPipeServerStream(pipeName);
     "[NamePipeServer][{0}] Pipe created {1}".format(pipeName, namedPipeServerStream.GetHashCode()).info();
     O2Thread.mtaThread(
         () =>
         {
             namedPipeServerStream.WaitForConnection();
             "[NamePipeServer][{0}] Pipe connection established".format(pipeName).info();
             using (var streamReader = new StreamReader(namedPipeServerStream))
             {
                 string line;
                 while ((line = streamReader.ReadLine()) != null)
                 {
                     //"received text:{0}".format(line).debug();
                     dataReceived(line);
                 }
                 "[NamePipeServer][{0}] Connection lost or pipe terminated".format(pipeName).info();
                 if (onPipeTerminated != null)
                     onPipeTerminated();
             }
         });
     return namedPipeServerStream;
 }
开发者ID:njmube,项目名称:FluentSharp,代码行数:24,代码来源:NamePipes.cs

示例3: ThreadStartServer

        public void ThreadStartServer(object o)
        {
            // Create a name pipe
            using (NamedPipeServerStream pipeStream = new NamedPipeServerStream("CommPipe"))
            {
                Console.WriteLine("[Server] Pipe created {0}", pipeStream.GetHashCode());

                // Wait for a connection
                pipeStream.WaitForConnection();
                MainWindow.obj.Name += "\n[Server] Pipe connection established";
                using (StreamReader sr = new StreamReader(pipeStream))
                {
                    string temp;
                    // We read a line from the pipe and print it together with the current time
                    var ViewModel = o as IImageListViewModel; 
                    while ((temp = sr.ReadLine()) != "End Connection")
                    {
                        if (temp != null)
                            MainWindow.obj.Name += "\n" + temp;
                    }
                    MainWindow.obj.Name += "\n[Server] Connection terminated";
                }
            }
        }
开发者ID:Azad-Hall,项目名称:open-soft-2013-2014,代码行数:24,代码来源:SelectPreviousImageCommand.cs


注:本文中的System.IO.Pipes.NamedPipeServerStream.GetHashCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。