/// <summary>
 /// Construction 
 /// </summary>
 /// <param name="socket">client socket</param>
 /// <param name="socketServer">the socket server</param>
 /// <param name="logger">logger object for ouput session message</param>
 internal TcpSocketAsyncSession(Socket socket, ISocketServer socketServer, IMsgProtocol protocol, IList<IMsgFilter> requestFilters, IList<IMsgHandler> requestHandlers, ILogger logger)
     : base(protocol, requestFilters, requestHandlers, logger)
 {
     m_ClientSocket = socket;
     m_SocketServer = socketServer;
     m_Logger = logger;
 }
 public SocketSessionBase(IMsgProtocol protocol,  IList<IMsgFilter> requestFilters, IList<IMsgHandler> requestHandlers, ILogger logger)
 {
     SessionId = null;
     m_RquestProtocol = protocol;
     m_RequestHandlers = requestHandlers;
     m_RequestFilters = requestFilters;
     m_Logger = logger;
 }
 /// <summary>
 /// Construction 
 /// </summary>
 /// <param name="socket">client socket</param>
 /// <param name="socketServer">the socket server</param>
 /// <param name="logger">logger object for ouput session message</param>
 internal UdpSocketAsyncSession(Socket socket, ISocketServer socketServer, IMsgProtocol protocol, IList<IMsgFilter> requestFilters, IList<IMsgHandler> requestHandlers, ILogger logger)
     : base(protocol, requestFilters, requestHandlers, logger)
 {
     SessionTimeout = (socketServer as UdpSocketAsyncServer).SessionTimeout;
     m_ClientSocket = socket;
     m_SocketServer = socketServer;
     m_Logger = logger;
     m_SocketAsyncSender = new UdpSocketAsyncSender(socket, socketServer);
 }
        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);
          
        }
        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>();
        }