public void Connect(string address, int port) { if (m_telnet.IsConnected) { m_telnet.Disconnect(); } m_telnet.Connect(address, port); }
public bool Connect(IAudit audit, string host, int port, string lu, ConnectionConfig config) { tn = new Telnet(this, audit, config); tn.UseSSL = mUseSSL; tn.trace.optionTraceAnsi = mDebug; tn.trace.optionTraceDS = mDebug; tn.trace.optionTraceDSN = mDebug; tn.trace.optionTraceEvent = mDebug; tn.trace.optionTraceNetworkData = mDebug; tn.telnetDataEvent += new TelnetDataDelegate(tn_telnetDataEvent); if (lu == null || lu.Length == 0) { tn.lus = null; } else { tn.lus = new System.Collections.ArrayList(); tn.lus.Add(lu); } tn.Connect(this, host, port); if (!tn.WaitForConnect()) { tn.Disconnect(); string text = tn.DisconnectReason; tn = null; throw new TNHostException("connect to " + host + " on port " + port + " failed", text, null); //return false; } tn.trace.WriteLine("--connected"); return(true); }
/// <summary> /// Disconnects the connected telnet object from the host /// </summary> public void Disconnect() { if (tn != null) { tn.Disconnect(); tn = null; } }
public void Disconnect() { if (m_telnet.IsConnected) { ChiConsole.WriteLine("Disconnecting {0}:{1}", m_telnet.Address, m_telnet.Port); } m_telnet.Disconnect(); }
/// <summary> /// Disconnects the connected telnet object from the host /// </summary> public void Disconnect() { if (tn != null) { tn.Disconnect(); tn.CursorLocationChanged -= tn_CursorLocationChanged; tn = null; } }
/// <summary> /// Connects a Telnet object to the host using the parameters provided /// </summary> /// <param name="audit">IAudit interface to post debug/tracing to</param> /// <param name="host">host ip/name</param> /// <param name="port">port to use</param> /// <param name="lu">lu to use or empty string for host negotiated</param> /// <param name="config">configuration parameters</param> /// <returns></returns> public bool Connect(IAudit audit, string host, int port, string lu, ConnectionConfig config) { if (tn != null) { tn.CursorLocationChanged -= tn_CursorLocationChanged; } tn = new Telnet(this, audit, config); tn.Trace.optionTraceAnsi = debug; tn.Trace.optionTraceDS = debug; tn.Trace.optionTraceDSN = debug; tn.Trace.optionTraceEvent = debug; tn.Trace.optionTraceNetworkData = debug; tn.telnetDataEventOccurred += tn_DataEventReceived; tn.CursorLocationChanged += tn_CursorLocationChanged; if (lu == null || lu.Length == 0) { tn.Lus = null; } else { tn.Lus = new List <string>(); tn.Lus.Add(lu); } if (!string.IsNullOrEmpty(sourceIP)) { tn.Connect(this, host, port, sourceIP); } else { tn.Connect(this, host, port); } if (!tn.WaitForConnect()) { tn.Disconnect(); var text = tn.DisconnectReason; tn = null; throw new TNHostException("connect to " + host + " on port " + port + " failed", text, null); } tn.Trace.WriteLine("--connected"); return(true); }
public bool Connect(IAudit audit, string host, int port, string lu, ConnectionConfig config) { tn = new Telnet(this, audit, config); tn.UseSSL = mUseSSL; tn.trace.optionTraceAnsi = mDebug; tn.trace.optionTraceDS = mDebug; tn.trace.optionTraceDSN = mDebug; tn.trace.optionTraceEvent = mDebug; tn.trace.optionTraceNetworkData = mDebug; tnDataDelegate = new TelnetDataDelegate(tn_telnetDataEvent); // CFC,Jr 8/2/2008 tn.telnetDataEvent += tnDataDelegate; if (lu == null || lu.Length == 0) { tn.lus = null; } else { tn.lus = new System.Collections.ArrayList(); tn.lus.Add(lu); } // Modified CFCJR Feb/29/2008 to allow for local IP endpoint if (!string.IsNullOrEmpty(_sourceIP)) { tn.Connect(this, host, port, _sourceIP); } else { tn.Connect(this, host, port); } if (!tn.WaitForConnect()) { tn.Disconnect(); string text = tn.DisconnectReason; tn = null; throw new TNHostException("connect to " + host + " on port " + port + " failed", text, null); //return false; } tn.trace.WriteLine("--connected"); return(true); }