Пример #1
0
        public AsyncSocketServer(int numConnections)
        {
            m_numConnections    = numConnections;
            m_receiveBufferSize = ProtocolConst.ReceiveBufferSize;

            m_asyncSocketUserTokenPool = new AsyncSocketUserTokenPool(numConnections);
            LogOutputSocketProtocolMgr = new LogOutputSocketProtocolMgr();
            AsyncSocketUserTokenList   = new AsyncSocketUserTokenList();
            m_maxNumberAcceptedClients = new Semaphore(numConnections, numConnections);
            UploadSocketProtocolMgr    = new UploadSocketProtocolMgr();
        }
Пример #2
0
        public AsyncSocketServer(int numConnections)
        {
            m_numConnections = numConnections;//设置服务器最大并发访问数
            m_receiveBufferSize = ProtocolConst.ReceiveBufferSize;//设置接收缓存区大小

            m_asyncSocketUserTokenPool = new AsyncSocketUserTokenPool(numConnections);//设置AsyncSocketUserTokenPool缓冲池的大小(栈实现)
            m_asyncSocketUserTokenList = new AsyncSocketUserTokenList();//初始化AsyncSocketUserToken列表
            m_maxNumberAcceptedClients = new Semaphore(numConnections, numConnections);//初始化信号量(有点不太懂)

            //-----------------------未看------------------------------//
            m_logOutputSocketProtocolMgr = new LogOutputSocketProtocolMgr();//日志输出对象
            m_uploadSocketProtocolMgr = new UploadSocketProtocolMgr();//上传
            //-----------------------未看------------------------------//
        }