当前位置: 首页>>代码示例>>C#>>正文


C# Session.Disconnect方法代码示例

本文整理汇总了C#中Session.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# Session.Disconnect方法的具体用法?C# Session.Disconnect怎么用?C# Session.Disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session.Disconnect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Destroy

 internal void Destroy(Session session)
 {
     lock (_syncLock)
     {
         session.Disconnect(true);
         _sessions.Remove(session);
     }
 }
开发者ID:GoneUp,项目名称:ModuleFilter,代码行数:8,代码来源:SessionManager.cs

示例2: Connect

        public static bool Connect(int serverType, string serverName, string user, string pass, string database,
            bool writeDbConfigFile)
        {
            var sConnectionString = GetConnectionString(serverType, serverName, user, pass, database);

            XpoDefault.ConnectionString = sConnectionString;
            try
            {
                var s = new Session();
                s.Connect();
                s.Disconnect();

                // Kết nối thành công thì lưu xuống file dbConfig.con
                if (writeDbConfigFile)
                {
                    var dbConfigPath = Application.StartupPath + @"\DatabaseConfig.con";
                    WriteDatabaseConfig(dbConfigPath, serverType, serverName, user, pass, database);
                }
            }
            catch (Exception ex)
            {
                EasyDialog.ShowErrorDialog("Không kết nối được CSDL (" + ex.Message + ")");
                return false;
            }

            return true;
        }
开发者ID:congnguyendl,项目名称:CnAppMedic,代码行数:27,代码来源:Connector.cs

示例3: DisposeShouldNotThrowExceptionWhenConenectHasNotBeenInvoked

        public void DisposeShouldNotThrowExceptionWhenConenectHasNotBeenInvoked()
        {
            var connectionInfo = new ConnectionInfo("localhost", 6767, Resources.USERNAME,
                new KeyboardInteractiveAuthenticationMethod(Resources.USERNAME));
            var session = new Session(connectionInfo, _serviceFactoryMock.Object);

            session.Disconnect();
        }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:8,代码来源:SessionTest.cs

示例4: DisconnectShouldNotThrowExceptionWhenSocketIsNotConnected

        public void DisconnectShouldNotThrowExceptionWhenSocketIsNotConnected()
        {
            var connectionInfo = new ConnectionInfo("localhost", 6767, Resources.USERNAME,
                new KeyboardInteractiveAuthenticationMethod(Resources.USERNAME));
            var session = new Session(connectionInfo, _serviceFactoryMock.Object);

            try
            {
                session.Connect();
                Assert.Fail();
            }
            catch (SocketException)
            {
                session.Disconnect();
            }
        }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:16,代码来源:SessionTest.cs

示例5: AcceptSocket

 private void AcceptSocket(IAsyncResult ar)
 {
     try
     {
         var socket = _listenser.EndAcceptSocket(ar);
         Task.Run(() =>
         {
             var session = new Session(socket, _hostKey);
             session.Disconnected += (ss, ee) => { lock (_lock) _sessions.Remove(session); };
             lock (_lock)
                 _sessions.Add(session);
             try
             {
                 if (ConnectionAccepted != null)
                     ConnectionAccepted(this, session);
                 session.EstablishConnection();
             }
             catch (SshConnectionException ex)
             {
                 session.Disconnect(ex.DisconnectReason, ex.Message);
                 if (ExceptionRasied != null)
                     ExceptionRasied(this, ex);
             }
             catch (Exception ex)
             {
                 session.Disconnect();
                 if (ExceptionRasied != null)
                     ExceptionRasied(this, ex);
             }
         });
     }
     catch
     {
     }
     finally
     {
         BeginAcceptSocket();
     }
 }
开发者ID:jinhang2008,项目名称:FxSsh,代码行数:39,代码来源:SshServer.cs


注:本文中的Session.Disconnect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。