Exemple #1
0
        public SocketMonitor(IProtocol protocol, TCPOptions config, PoolProvider poolProvider)
        {
            Preconditions.ThrowIfNull(protocol, "protocol");
            Preconditions.ThrowIfNull(config, "config");

            this.Protocol     = protocol;
            this.Option       = config;
            this.PoolProvider = poolProvider;
        }
Exemple #2
0
        static TCPOptions()
        {
            SERVER_DEFAULT = new TCPOptions
            {
                AutoRecycleSession = true,
                RecycleSecond      = 30000,
                SendTimeout        = 10000,

                MaxBlockSize = 500,

                IncreasesOfEventArgPool = 10,
                MaxOfClient             = 0,

                BufferSizeOfReceiveBufferPool = 1024,//每个接收缓冲区的大小
                IncreasesOfReceiveBufferPool  = 10,
                MaxOfReceiveBufferPool        = 0,


                BufferSizeOfPacketBufferPool = 1024,
                IncreasesOfPacketBufferPool  = 1000,
                MaxOfPacketBufferPool        = 0,

                IncreasesOfSendingQueuePool = 1000,
                MaxOfSendingQueuePool       = 0,
                SizeOfSendQueue             = 6,
            };

            CLIENT_DEFAULT = new TCPOptions
            {
                AutoRecycleSession = true,
                RecycleSecond      = 30000,
                SendTimeout        = 10000,

                MaxBlockSize = 500,

                IncreasesOfEventArgPool = 10,
                MaxOfClient             = 0,

                BufferSizeOfReceiveBufferPool = 1024,//每个接收缓冲区的大小
                IncreasesOfReceiveBufferPool  = 10,
                MaxOfReceiveBufferPool        = 0,


                BufferSizeOfPacketBufferPool = 1024,
                IncreasesOfPacketBufferPool  = 1000,
                MaxOfPacketBufferPool        = 0,

                IncreasesOfSendingQueuePool = 1000,
                MaxOfSendingQueuePool       = 0,
                SizeOfSendQueue             = 6,
            };
        }
Exemple #3
0
 public TCPServer(IProtocol protocol, TCPOptions option) : base(protocol, option, new PoolProvider(option))
 {
     this._Sessions = new ConcurrentDictionary <long, TSession>();
 }