Пример #1
0
 public string Parse(string url, out string objectURI)
 {
     return(IpcChannelHelper.Parse(url, out objectURI));
 }
Пример #2
0
        public IpcClientChannelSink(string url)
        {
            string unused;

            IpcChannelHelper.Parse(url, out pipeName, out unused);
        }
Пример #3
0
        void ProcessClient(object state)
        {
            try
            {
                NamedPipeSocket socket = (NamedPipeSocket)state;

                ITransportHeaders requestHeaders;
                Stream            requestStream;

                IpcTransport t = new IpcTransport(socket);
                t.Read(out requestHeaders, out requestStream);

                // parse the RequestUri
                string objectUri;
                string uri = (string)requestHeaders[CommonTransportKeys.RequestUri];
                IpcChannelHelper.Parse(uri, out objectUri);
                if (objectUri == null)
                {
                    objectUri = uri;
                }
                requestHeaders[CommonTransportKeys.RequestUri] = objectUri;

                ServerChannelSinkStack stack = new ServerChannelSinkStack();
                stack.Push(this, null);

                IMessage          responseMsg;
                ITransportHeaders responseHeaders;
                Stream            responseStream;

                requestHeaders["__CustomErrorsEnabled"] = false;

                if (impersonate)
                {
                    // TODO: Impersonate might throw exceptions. What to do with them?
                    socket.Impersonate();
                }

                ServerProcessing op = nextSink.ProcessMessage(
                    stack,
                    null,
                    requestHeaders,
                    requestStream,
                    out responseMsg,
                    out responseHeaders,
                    out responseStream
                    );

                if (impersonate)
                {
                    NamedPipeSocket.RevertToSelf();
                }

                switch (op)
                {
                case ServerProcessing.Complete:
                    stack.Pop(this);
                    // send the response headers and the response data to the client
                    t.Write(responseHeaders, responseStream);
                    break;

                case ServerProcessing.Async:
                    stack.StoreAndDispatch(nextSink, null);
                    break;

                case ServerProcessing.OneWay:
                    break;
                }
            }
            catch (Exception)
            {
                // Console.WriteLine(ex);
            }
        }