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