コード例 #1
0
        public override void initializeServer( ServerConfig config,  IMsgProtocol protocol,  IList<IConnectFilter> connectFilters,  IList<IMsgFilter> requestFilters,  IList<IMsgHandler> requestHandlers, ILogger logger)
        {
            base.initializeServer(config, protocol, connectFilters, requestFilters, requestHandlers, logger);
 
            bufferManager = new BufferManager(BufferSize * MaxSessionCount, BufferSize);
            m_ReadWritePool = new SocketAsyncEventArgsPool(MaxSessionCount);
            m_ReadWritePool.Initize(bufferManager);
          
        }
コード例 #2
0
        public override void initializeServer(ServerConfig config, IMsgProtocol protocol, IList<IConnectFilter> connectFilters, IList<IMsgFilter> requestFilters, IList<IMsgHandler> requestHandlers, ILogger logger)
        {
            base.initializeServer(config, protocol, connectFilters, requestFilters, requestHandlers, logger);

            m_ListenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            //数据通讯socket
            m_DataSockeet = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

            //随机生成数据端口
            // ServerDataSocketPort = ServerPort + (new Random()).Next(1, 100);
            ServerDataSocketPort = ServerPort + 1;

            r_bufferManager = new BufferManager(BufferSize * MaxSessionCount, BufferSize);
            m_ReadPool = new SocketAsyncEventArgsPool(MaxSessionCount);
            m_ReadPool.Initize(r_bufferManager);

            m_bufferManager = new ConcurrentDictionary<string, UdpSocketAsyncBuffer>();
        }