/// <summary> /// Opens the connection to the client. /// </summary> /// <exception cref="InvalidOperationException">The connection is already open.</exception> public virtual void Open() { if (Connected) { throw new InvalidOperationException("The connection is already open."); } // dispose of existing connection TcpConnection?.Close(); // create new TcpConnection and connect TcpConnection = _tcpConnectionFactory.Create(); TcpConnection.Connect(Host, Port, ConnectionTimeout); }