コード例 #1
0
ファイル: ClientCore.cs プロジェクト: lonely21/chiroptera
        public void Connect(string address, int port)
        {
            if (m_telnet.IsConnected)
            {
                m_telnet.Disconnect();
            }

            m_telnet.Connect(address, port);
        }
コード例 #2
0
ファイル: TN3270API.cs プロジェクト: cbuosi/Extrinha
        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);
        }
コード例 #3
0
ファイル: TN3270API.cs プロジェクト: edusis/open3270
 /// <summary>
 /// Disconnects the connected telnet object from the host
 /// </summary>
 public void Disconnect()
 {
     if (tn != null)
     {
         tn.Disconnect();
         tn = null;
     }
 }
コード例 #4
0
ファイル: ClientCore.cs プロジェクト: lonely21/chiroptera
        public void Disconnect()
        {
            if (m_telnet.IsConnected)
            {
                ChiConsole.WriteLine("Disconnecting {0}:{1}", m_telnet.Address, m_telnet.Port);
            }

            m_telnet.Disconnect();
        }
コード例 #5
0
 /// <summary>
 ///     Disconnects the connected telnet object from the host
 /// </summary>
 public void Disconnect()
 {
     if (tn != null)
     {
         tn.Disconnect();
         tn.CursorLocationChanged -= tn_CursorLocationChanged;
         tn = null;
     }
 }
コード例 #6
0
        /// <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);
        }
コード例 #7
0
ファイル: TN3270API.cs プロジェクト: edusis/open3270
        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);
        }