public AsyncSocketServerBase(int MaxConnections, INotifier notifier) : base(notifier) { NumMaxConnctions = MaxConnections; m_maxNumberAcceptClients = new Semaphore(NumMaxConnctions, NumMaxConnctions); ConnectionList = new AsyncUserTokenList(); m_asyncUserTokenPool = new AsyncUserTokenPool(NumMaxConnctions); m_totalSerial = 0; m_totalReceiveBytes = 0; m_totalSendBytes = 0; m_disposed = false; IsClosed = true; }
private void Dispose(bool disposing) { if (m_disposed) { return; } if (disposing) { //释放托管资源 ConnectionList = null; m_asyncUserTokenPool = null; } //释放非托管资源 m_maxNumberAcceptClients.Dispose(); if (m_listenSocket != null) { m_listenSocket.Dispose(); } m_disposed = true; }