TrotiNet.TcpServer.CheckSockets C# (CSharp) Method

CheckSockets() protected method

Close broken sockets
This function is called regularly to clean up the list of connected sockets.
protected CheckSockets ( object eventState ) : void
eventState object
return void
        void CheckSockets(object eventState)
        {
            try
            {
                lock (ConnectedSockets)
                {
                    foreach (var kv in ConnectedSockets)
                    {
                        try
                        {
                            int id = kv.Key;
                            HttpSocket state = kv.Value;
                            if (state == null || state.IsSocketDead())
                                ConnectedSockets.Remove(id);
                        }
                        catch (Exception e)
                        {
                            log.Error(e);
                        }
                    }
                }
            }
            catch { }
        }