Пример #1
0
        public void Dispose()
        {
            try
            {
                Handle.Shutdown(SocketShutdown.Both);
                Handle.Close();
            }
            catch (Exception ex)
            {
                SysLogger.Log(ex.Message, SysLogType.Error);
            }

            this.Connection = null;
            this.Properties = null;
            this.Handle     = null;
            this.Server     = null;
            this.clientHS   = null;
            this.serverHS   = null;

            if (this.KeepAliveTimer != null)
            {
                this.KeepAliveTimer.Enabled = false;
            }

            this.IsDisposed = true;

            try
            {
                onDisconnect(DisconnectReason.UserDisconnection);
            }
            catch (Exception ex)
            {
                SysLogger.Log(ex.Message, SysLogType.Error);
            }
        }
Пример #2
0
        public void Dispose()
        {
            try
            {
                Handle.Shutdown(SocketShutdown.Both);
                Handle.Close();
            }
            catch (Exception ex)
            {
                SysLogger.Log(ex.Message, SysLogType.Error);
            }

            this.Connection = null;
            this.Properties = null;
            this.Handle = null;
            this.Server = null;
            this.clientHS = null;
            this.serverHS = null;

            if(this.KeepAliveTimer != null)
                this.KeepAliveTimer.Enabled = false;

            this.IsDisposed = true;

            try
            {
                onDisconnect(DisconnectReason.UserDisconnection);
            }
            catch (Exception ex)
            {
                SysLogger.Log(ex.Message, SysLogType.Error);
            }
        }