Ejemplo n.º 1
0
        /// <summary>实例化增强UDP</summary>
        public UdpServer()
        {
            Local.Type  = NetType.Udp;
            Remote.Type = NetType.Udp;
            _Sessions   = new SessionCollection(this);

            StatSession = new Statistics();

            SessionTimeout = Setting.Current.SessionTimeout;
        }
Ejemplo n.º 2
0
        /// <summary>实例化增强UDP</summary>
        public UdpServer()
        {
            SessionTimeout = 30;

            Local = new NetUri(ProtocolType.Udp, IPAddress.Any, 0);
            Remote.ProtocolType = ProtocolType.Udp;
            _Sessions           = new SessionCollection(this);

            StatSession = new Statistics();
        }
Ejemplo n.º 3
0
        /// <summary>构造TCP服务器对象</summary>
        public TcpServer()
        {
            Name = GetType().Name;

            Local          = new NetUri(NetType.Tcp, IPAddress.Any, 0);
            SessionTimeout = Setting.Current.SessionTimeout;
            MaxAsync       = Environment.ProcessorCount * 16 / 10;
            _Sessions      = new SessionCollection(this);

            Log = Logger.Null;
        }
Ejemplo n.º 4
0
        /// <summary>实例化增强UDP</summary>
        public UdpServer()
        {
            //SessionTimeout = 30;

            Local       = new NetUri(NetType.Udp, IPAddress.Any, 0);
            Remote.Type = NetType.Udp;
            _Sessions   = new SessionCollection(this);

            StatSession = new Statistics();
            //PacketQueue = new DefaultPacketQueue();
        }
Ejemplo n.º 5
0
        /// <summary>实例化增强UDP</summary>
        public UdpServer()
        {
            SessionTimeout = 30;

            // Udp服务器不能关闭自己,但是要关闭会话
            // Udp客户端一般不关闭自己
            //EnableReset = false;

            Local       = new NetUri(NetType.Udp, IPAddress.Any, 0);
            Remote.Type = NetType.Udp;
            _Sessions   = new SessionCollection(this);

            StatSession = new Statistics();
        }
Ejemplo n.º 6
0
        /// <summary>实例化增强UDP</summary>
        public UdpServer()
        {
            Local.Type  = NetType.Udp;
            Remote.Type = NetType.Udp;
            _Sessions   = new SessionCollection(this);

            //StatSession = new PerfCounter();
            SessionTimeout = Setting.Current.SessionTimeout;

            // 处理UDP最大并发接收
            MaxAsync = Environment.ProcessorCount * 16 / 10;

            ProcessAsync = true;
        }
Ejemplo n.º 7
0
        private void CloseAllSession()
        {
            var sessions = _Sessions;

            if (sessions != null)
            {
                _Sessions = null;

                if (sessions.Count > 0)
                {
                    WriteLog("准备释放会话{0}个!", sessions.Count);
                    sessions.TryDispose();
                    sessions.Clear();
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>构造TCP服务器对象</summary>
        public TcpServer()
        {
            Name = this.GetType().Name;

            Local            = new NetUri(ProtocolType.Tcp, IPAddress.Any, 0);
            SessionTimeout   = 30;
            AutoReceiveAsync = true;
            UseProcessAsync  = true;

            _Sessions   = new SessionCollection(this);
            StatSession = new Statistics();
            StatSend    = new Statistics();
            StatReceive = new Statistics();

            Log = Logger.Null;
        }
Ejemplo n.º 9
0
        /// <summary>实例化增强UDP</summary>
        public UdpServer()
        {
            Local.Type  = NetType.Udp;
            Remote.Type = NetType.Udp;
            _Sessions   = new SessionCollection(this);

            SessionTimeout = Setting.Current.SessionTimeout;

            // 处理UDP最大并发接收
            MaxAsync = Environment.ProcessorCount * 16 / 10;

            if (Setting.Current.Debug)
            {
                Log = XTrace.Log;
            }
        }
Ejemplo n.º 10
0
        /// <summary>构造TCP服务器对象</summary>
        public TcpServer()
        {
            Name = GetType().Name;

            Local            = new NetUri(NetType.Tcp, IPAddress.Any, 0);
            SessionTimeout   = 30;
            AutoReceiveAsync = true;
            UseProcessAsync  = true;

            MaxAsync = Environment.ProcessorCount * 16 / 10;

            _Sessions   = new SessionCollection(this);
            StatSession = new Statistics();
            StatSend    = new Statistics();
            StatReceive = new Statistics();

            Log = Logger.Null;
        }