예제 #1
0
        /// <exception cref="NSch.JSchException"></exception>
        public override void Start()
        {
            Session _session = GetSession();

            try
            {
                Request request;
                if (xforwading)
                {
                    request = new RequestX11();
                    request.DoRequest(_session, this);
                }
                if (pty)
                {
                    request = new RequestPtyReq();
                    request.DoRequest(_session, this);
                }
                request = new RequestSubsystem();
                ((RequestSubsystem)request).Request(_session, this, subsystem, want_reply);
            }
            catch (Exception e)
            {
                if (e is JSchException)
                {
                    throw (JSchException)e;
                }
                if (e is Exception)
                {
                    throw new JSchException("ChannelSubsystem", (Exception)e);
                }
                throw new JSchException("ChannelSubsystem");
            }
            if (io.@in != null)
            {
                thread = new Sharpen.Thread(this);
                thread.SetName("Subsystem for " + _session.host);
                if (_session.daemon_thread)
                {
                    thread.SetDaemon(_session.daemon_thread);
                }
                thread.Start();
            }
        }
예제 #2
0
		/// <exception cref="NSch.JSchException"></exception>
		public override void Start()
		{
			Session _session = GetSession();
			try
			{
				Request request;
				if (xforwading)
				{
					request = new RequestX11();
					request.DoRequest(_session, this);
				}
				if (pty)
				{
					request = new RequestPtyReq();
					request.DoRequest(_session, this);
				}
				request = new RequestSubsystem();
				((RequestSubsystem)request).Request(_session, this, subsystem, want_reply);
			}
			catch (Exception e)
			{
				if (e is JSchException)
				{
					throw (JSchException)e;
				}
				if (e is Exception)
				{
					throw new JSchException("ChannelSubsystem", (Exception)e);
				}
				throw new JSchException("ChannelSubsystem");
			}
			if (io.@in != null)
			{
				thread = new Sharpen.Thread(this);
				thread.SetName("Subsystem for " + _session.host);
				if (_session.daemon_thread)
				{
					thread.SetDaemon(_session.daemon_thread);
				}
				thread.Start();
			}
		}
예제 #3
0
        /// <exception cref="System.Exception"></exception>
        protected internal virtual void SendRequests()
        {
            Session _session = GetSession();
            Request request;

            if (agent_forwarding)
            {
                request = new RequestAgentForwarding();
                request.DoRequest(_session, this);
            }
            if (xforwading)
            {
                request = new RequestX11();
                request.DoRequest(_session, this);
            }
            if (pty)
            {
                request = new RequestPtyReq();
                ((RequestPtyReq)request).SetTType(ttype);
                ((RequestPtyReq)request).SetTSize(tcol, trow, twp, thp);
                if (terminal_mode != null)
                {
                    ((RequestPtyReq)request).SetTerminalMode(terminal_mode);
                }
                request.DoRequest(_session, this);
            }
            if (env != null)
            {
                for (IEnumerator _env = env.Keys.GetEnumerator(); _env.MoveNext();)
                {
                    object name  = _env.Current;
                    object value = env[name];
                    request = new RequestEnv();
                    ((RequestEnv)request).SetEnv(ToByteArray(name), ToByteArray(value));
                    request.DoRequest(_session, this);
                }
            }
        }
예제 #4
0
		/// <exception cref="System.Exception"></exception>
		protected internal virtual void SendRequests()
		{
			Session _session = GetSession();
			Request request;
			if (agent_forwarding)
			{
				request = new RequestAgentForwarding();
				request.DoRequest(_session, this);
			}
			if (xforwading)
			{
				request = new RequestX11();
				request.DoRequest(_session, this);
			}
			if (pty)
			{
				request = new RequestPtyReq();
				((RequestPtyReq)request).SetTType(ttype);
				((RequestPtyReq)request).SetTSize(tcol, trow, twp, thp);
				if (terminal_mode != null)
				{
					((RequestPtyReq)request).SetTerminalMode(terminal_mode);
				}
				request.DoRequest(_session, this);
			}
			if (env != null)
			{
				foreach (var v in env.Keys)
				{
					object name = v;
					object value = env[name];
					request = new RequestEnv();
					((RequestEnv)request).SetEnv(ToByteArray(name), ToByteArray(value));
					request.DoRequest(_session, this);
				}
			}
		}