protected override void Negotiate() { TelnetNegotiator neg = new TelnetNegotiator(_param, _size.Width, _size.Height); TelnetTerminalConnection r = new TelnetTerminalConnection(_param, neg, new PlainGuevaraSocket(_socket), _size.Width, _size.Height); r.UsingSocks = _socks != null; r.SetServerInfo(_param.Host, this.IPAddress); _result = new ConnectionTag(r); }
public ConnectionTag Connect() { lock (_lockObject) { if (_localPort == 0) { PrepareListener(); } PrepareEnv(_param); } string cygtermPath = "cygterm\\" + (IsCygwin(_param)? "cygterm.exe" : "sfuterm.exe"); string connectionName = IsCygwin(_param)? "Cygwin" : "SFU"; string args = String.Format("-p {0} -v HOME=\"{1}\" -s \"{2}\"", _localPort, _param.Home, _param.Shell); ProcessStartInfo psi = new ProcessStartInfo(cygtermPath, args); psi.CreateNoWindow = true; psi.ErrorDialog = true; psi.UseShellExecute = false; psi.WindowStyle = ProcessWindowStyle.Hidden; _process = Process.Start(psi); if (_interrupted) { return(null); } Socket sock = _listener.Accept(); if (_interrupted) { return(null); } Size sz = GEnv.Frame.TerminalSizeForNextConnection; TelnetNegotiator neg = new TelnetNegotiator(_param, sz.Width, sz.Height); TelnetTerminalConnection r = new TelnetTerminalConnection(_param, neg, new PlainGuevaraSocket(sock), sz.Width, sz.Height); r.UsingSocks = false; r.SetServerInfo(connectionName, null); return(new ConnectionTag(r)); }