當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。