public void Open(TimeSpan timeout) { try { if (_connector.IsConnected) { return; } _connector.Connected += OnConnected; _connector.Disconnected += OnDisconnected; _connector.Connect(timeout); OnOpen(); } catch (TimeoutException) { _log.ErrorFormat("Connect remote [{0}] timeout with [{1}].", this.ConnectToEndPoint, timeout); Close(); } }
public void Open() { try { if (_connector.IsConnected) { return; } _connector.TransportConnected += OnTransportConnected; _connector.TransportDisconnected += OnTransportDisconnected; _connector.Connect(); OnOpen(); } catch (TimeoutException) { _log.ErrorFormat("Connect remote [{0}] timeout with [{1}].", this.ConnectToEndPoint, _connector.TransportConfiguration.ConnectTimeout); Close(); } }