Exemplo n.º 1
0
        public void ProcessClient(Socket client)
        {
            //System.Threading.Thread.Sleep(50); //Small delay so the process will be using 0-1% cpu usage at flood attack
            if (File_MaxConnections.AcceptConnection(client.RemoteEndPoint))
            {
                int ID = _clientList.Count;
                FileClients c = new FileClients(client, NetworkKey);
                _clientList.Add(ID, c);
                c.DisconnectHandle = OnDisconnect;
                c.ClientID = ID;

                settings.ClientsConnected++;
                Logger.AddLog(new LogInfo("Incoming client", "Accepted"));
            }
            else
            {
                client.Disconnect(false);
                client = null;
            }
        }
Exemplo n.º 2
0
        public void ProcessClient(Socket client)
        {
            //System.Threading.Thread.Sleep(50); //Small delay so the process will be using 0-1% cpu usage at flood attack
            if (File_MaxConnections.AcceptConnection(client.RemoteEndPoint))
            {
                int         ID = _clientList.Count;
                FileClients c  = new FileClients(client, NetworkKey);
                _clientList.Add(ID, c);
                c.DisconnectHandle = OnDisconnect;
                c.ClientID         = ID;

                settings.ClientsConnected++;
                Logger.AddLog(new LogInfo("Incoming client", "Accepted"));
            }
            else
            {
                client.Disconnect(false);
                client = null;
            }
        }
Exemplo n.º 3
0
 //This method is called by any client when its disconnected, this is done through a delegate thats set.
 private void OnDisconnect(FileClients client)
 {
     _clientList.Remove(client.ClientID);
 }
Exemplo n.º 4
0
 //This method is called by any client when its disconnected, this is done through a delegate thats set.
 private void OnDisconnect(FileClients client)
 {
     _clientList.Remove(client.ClientID);
 }