Пример #1
0
        public void Connect()
        {
            var connected = false;

            while (!connected)
            {
                try
                {
                    try
                    {
                        ConectToExsistingServerConnection();
                        connected = true;
                    }
                    catch (TimeoutException)
                    {
                        this.Server = null;
                        this.client = null;
                        SetupServerConnection();
                        connected = true;
                    }
                }
                catch (IOException ex)
                {
                    this.Server = null;
                    this.client = null;
                }
            }
            SetupSecondairyConnection();
        }
Пример #2
0
        private void SetupSecondairyConnection()
        {
            if (InitialConnectionStartedAsServer())
            {
                Server.WaitForConnection();

                // GiveSecondairyServerTimeToStart(); probably not even required...
                client = new ClientNamedPipeConnection <T>(GetSecondairyConnectionName(), this.writer);
                client.Connect();
            }
            else
            {
                Server = new ServerNamedPipeConnection <T>(GetSecondairyConnectionName(), this.reader);
                Server.WaitForConnection();
            }
        }
Пример #3
0
 private void SetupServerConnection()
 {
     this.Server = new ServerNamedPipeConnection <T>(GetInitialConnectionName(), reader);
 }