public virtual void Open() { if (this.IsOpen) throw new ConnectionAlreadyOpenException(); IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties(); IPEndPoint[] ipEndPoints = ipGlobalProperties.GetActiveTcpListeners(); foreach (IPEndPoint ipEndPoint in ipEndPoints) { if (ipEndPoint.Port == this.localport) { throw new PortAlreadyInUseException(this); } } this.puttyLink = new PuttyLink(this); Thread thread = new Thread(new ThreadStart(this.puttyLink.Start)); thread.IsBackground = true; thread.Start(); }
public Connection(string name, string hostname, int port,int localport,ConnectionType ct,string remotehost,int remoteport) { this.name = name; this.hostname = hostname.Trim(); this.port = 22; this.compression = false; this.autoconnect = false; this.autoreconnect = false; this.localPortsAcceptAll = false; this.puttyLink = null; this.resume = false; this.connectionType = ct; this.localport = localport; this.remotehost = remotehost; this.remoteport = remoteport; SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged); }
public virtual void Close() { if (this.IsOpen) this.puttyLink.Stop(); this.puttyLink = null; }