private void AsyncConnect(IAsyncResult res)
        {
            //Console.WriteLine("k i m o z");
            AsyncSocketWrapper sender = null;
            try
            {
                String IPAdress = "";
                sender = new AsyncSocketWrapper();
                sender.Create(this.Connection.EndAccept(res));
                IPAdress = sender.Socket.RemoteEndPoint.ToString().Split(':')[0].ToString();
                if (!BruteforceProtection.IsBanned(IPAdress))
                {
                    BruteforceProtection.AddWatch(IPAdress);
                    if (sender.Socket == null)
                    {
                        this.Connection.BeginAccept(new AsyncCallback(this.AsyncConnect), null);

                        return;
                    }
                    if (this.OnClientConnect != null)
                    {
                        this.OnClientConnect(sender);
                    }
                    sender.Socket.BeginReceive(sender.Buffer, 0, sender.Buffer.Length, SocketFlags.None, new AsyncCallback(this.AsyncReceive), sender);

                    this.Connection.BeginAccept(new AsyncCallback(this.AsyncConnect), null);
                }
            }
            catch (SocketException e)
            {
                Program.SaveException(e);
                Console.WriteLine(e);
                if (this.enabled)
                {
                    this.Connection.BeginAccept(new AsyncCallback(this.AsyncConnect), null);
                }
            }
            catch (ObjectDisposedException e)
            {
                Program.SaveException(e);
                Console.WriteLine(e);
            }
        }
 public void InvokeDisconnect(AsyncSocketWrapper Client)
 {
     if (Client != null)
     {
         try
         {
             if (Client.Socket.Connected)
             {
                 Client.Socket.Shutdown(SocketShutdown.Both);
                 Client.Socket.Close();
                 if (this.OnClientDisconnect != null)
                 {
                     this.OnClientDisconnect(Client);
                 }
                 Client.Connector = null;
                 Client = null;
             }
             else
             {
                 if (this.OnClientDisconnect != null)
                 {
                     this.OnClientDisconnect(Client);
                 }
                 Client.Connector = null;
                 Client = null;
             }
         }
         catch (ObjectDisposedException e)
         {
             Program.SaveException(e);
             Console.WriteLine(e);
         }
     }
 }