Esempio n. 1
0
        private static void ServerThread(object data)
        {
            var pipeServer = new NamedPipeServerStream(_pipeName, PipeDirection.InOut, NumThreads);
            var threadId   = Thread.CurrentThread.ManagedThreadId;

            // Wait for a client to connect
            pipeServer.WaitForConnection();

            try
            {
                // Read the request from the client. Once the client has
                // written to the pipe its security token will be available.

                var ss = new StreamString(pipeServer);

                var filename   = ss.ReadString();
                var fileReader = new Utils();

                pipeServer.RunAsClient(Utils.Start);

                // Catch the IOException that is raised if the pipe is broken
                // or disconnected.
            }
            catch
            {
            }
            finally
            {
                pipeServer.Close();
            }
        }
Esempio n. 2
0
        private static void ServerThread(object data)
        {
            var pipeServer = new NamedPipeServerStream(_pipeName, PipeDirection.InOut, _numThreads);
            var threadId   = Thread.CurrentThread.ManagedThreadId;

            pipeServer.WaitForConnection();

            try
            {
                var ss = new StreamString(pipeServer);

                var filename   = ss.ReadString();
                var fileReader = new Utils();

                pipeServer.RunAsClient(Utils.Start);
            }
            catch
            {
            }
            finally
            {
                pipeServer.Close();
            }
        }