コード例 #1
0
 public int GetConnectedCount()
 {
     return(_socketPool.GetCount());
 }
コード例 #2
0
        public override void Close()
        {
            try
            {
                Socket.Shutdown(SocketShutdown.Both);
            }
            catch (Exception)
            {
                _logger?.LogInformation("[{0}] Exception - Failed Shutdown method", SocketId);
            }

            SocketId = null;
            Socket.Close();
            Socket.Dispose();
            ReceiveSocketAsyncEventArgs.UserToken = null;
            Items.Clear();

            _socketPool.Push(this);
            _accessController.Release();

            _closedAction?.Invoke();
            _logger?.LogInformation("A client has been disconnected from the server. There are {0} clients connected to the server", _socketPool.GetCount());
        }