Exemplo n.º 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();
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 3
0
 private void SetupServerConnection()
 {
     this.Server = new ServerNamedPipeConnection <T>(GetInitialConnectionName(), reader);
 }