Пример #1
0
        public virtual void Open()
        {
            if (this.IsOpen)
            {
                throw new SessionAlreadyOpenException();
            }

            // Rather then just checking our own tunnels, just go over TCP listeners.
            foreach (Tunnel tunnel in this.Tunnels)
            {
                IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
                IPEndPoint[]       ipEndPoints        = ipGlobalProperties.GetActiveTcpListeners();

                foreach (IPEndPoint ipEndPoint in ipEndPoints)
                {
                    if (ipEndPoint.Port == tunnel.SourcePort)
                    {
                        throw new PortAlreadyInUseException(tunnel);
                    }
                }
            }

            this.puttyLink = new PuttyLink(this);
            Thread thread = new Thread(new ThreadStart(this.puttyLink.Start));

            thread.IsBackground = true;
            thread.Start();

            //OpenSessions.Add(this);
        }
Пример #2
0
        public virtual void Close()
        {
            if (this.IsOpen)
            {
                this.puttyLink.Stop();
            }

            //if (OpenSessions.Contains(this))
            //    OpenSessions.Remove(this);

            this.puttyLink = null;
        }
Пример #3
0
        public Session(string name, string hostname, int port)
        {
            this.name = name;
            this.hostname = hostname;
            this.username = "";
            this.port = port;
            this.compression = false;
            this.localPortsAcceptAll = false;
            this.tunnels = new List<Tunnel>();

            this.usePtmForTunnels = false;
            this.puttyLink = null;

            this.resume = false;

            SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);
        }
Пример #4
0
        public Session(string name, string hostname, int port)
        {
            this.name                = name;
            this.hostname            = hostname;
            this.username            = "";
            this.port                = port;
            this.compression         = false;
            this.localPortsAcceptAll = false;
            this.tunnels             = new List <Tunnel>();

            this.usePtmForTunnels = false;
            this.puttyLink        = null;

            this.resume = false;

            SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);
        }
Пример #5
0
        public virtual void Open()
        {
            if (this.IsOpen)
                throw new SessionAlreadyOpenException();

            // Rather then just checking our own tunnels, just go over TCP listeners.
            foreach (Tunnel tunnel in this.Tunnels)
            {
                IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
                IPEndPoint[] ipEndPoints = ipGlobalProperties.GetActiveTcpListeners();

                foreach (IPEndPoint ipEndPoint in ipEndPoints)
                {
                    if (ipEndPoint.Port == tunnel.SourcePort)
                    {
                        throw new PortAlreadyInUseException(tunnel);
                    }
                }
            }

            this.puttyLink = new PuttyLink(this);
            Thread thread = new Thread(new ThreadStart(this.puttyLink.Start));
            thread.IsBackground = true;
            thread.Start();

            //OpenSessions.Add(this);
        }
Пример #6
0
        public virtual void Close()
        {
            if (this.IsOpen)
                this.puttyLink.Stop();

            //if (OpenSessions.Contains(this))
            //    OpenSessions.Remove(this);

            this.puttyLink = null;
        }