Renci.SshNet.ForwardedPort.Start C# (CSharp) 메소드

Start() 공개 메소드

Starts port forwarding.
public Start ( ) : void
리턴 void
        public virtual void Start()
        {
            CheckDisposed();

            if (IsStarted)
                throw new InvalidOperationException("Forwarded port is already started.");
            if (Session == null)
                throw new InvalidOperationException("Forwarded port is not added to a client.");
            if (!Session.IsConnected)
                throw new SshConnectionException("Client not connected.");

            Session.ErrorOccured += Session_ErrorOccured;
            StartPort();
        }

Usage Example

        public void Open()
        {
            _client.Connect();

            _forwardedPort = new ForwardedPortLocal(LocalHost, LocalPort, _mySqlHost, (uint)_mySqlPort);
            _client.AddForwardedPort(_forwardedPort);
            _forwardedPort.Start();

            _connection.Open();
        }