Abstractions.Pipes.PipeClient.Start C# (CSharp) Метод

Start() публичный Метод

public Start ( Func action, object>.IDictionary initialMessage, int timeout ) : void
action Func
initialMessage object>.IDictionary
timeout int
Результат void
        public void Start(Func<BinaryReader, BinaryWriter, bool> action, IDictionary<string, object> initialMessage, int timeout)
        {
            StreamAction = action;

            using (NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", Name, PipeDirection.InOut,
                PipeOptions.WriteThrough, TokenImpersonationLevel.None, HandleInheritability.None))
            {
                for (int x = 1; x <= 5; x++)
                {
                    try
                    {
                        pipeClient.Connect(timeout);
                    }
                    catch (Exception e)
                    {
                        if (x == 5)
                        {
                            LibraryLogging.Error("Error connecting PipeClient: {0}", e);
                            return;
                        }
                        Thread.Sleep(100);
                    }
                }

                // Write the initial message to get the pumps running,
                //  error handling to prevent a pipe error exception
                try
                {
                    using (BinaryReader reader = new BinaryReader(pipeClient, Encoding.Unicode/*, true*/))
                    {
                        using (BinaryWriter writer = new BinaryWriter(pipeClient, Encoding.Unicode/*, true*/))
                        {
                            HandlePipeConnection(reader, writer, null);
                        }
                    }
                }
                catch (IOException)
                {
                    LibraryLogging.Error("Error broken pipe connection");
                    Start(action, initialMessage, timeout);
                }
            }
        }

Same methods

PipeClient::Start ( object>.Func action, object>.IDictionary initialMessage, int timeout ) : void
PipeClient::Start ( object>.IDictionary initialMessage ) : void
PipeClient::Start ( object>.IDictionary initialMessage, int timeout ) : void

Usage Example

Пример #1
0
 private void FakeClientToWakeEmAndShakem()
 {
     try
     {
         PipeClient client = new PipeClient(Name);
         client.Start(((r, w) => { return(false); }), null, 100);
     }
     catch { /* intentionally ignored */ }
 }
All Usage Examples Of Abstractions.Pipes.PipeClient::Start