Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5849107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:57:12+00:00 2026-05-22T12:57:12+00:00

my java server is currently being DDoSed by thousands of different ip’s. To counter

  • 0

my java server is currently being DDoSed by thousands of different ip’s. To counter it, i’ve been blocking the ip’s through the dedicated servers firewall. However just more and more keep coming. This attack is flooding my login server causing players to not be able to login.

I’ve asked on other places such as a forum for my type of java application, and i’ve gotten barely any answers. However they told me it’s a form of DDoS, also another user referred me to this however I don’t believe this would work. http://www.java2s.com/Open-Source/Java-Document/Net/mina-2.0.0-M1/org/apache/mina/filter/firewall/ConnectionThrottleFilter.java.htm

So apparently it’s a DoS on my login server, anyone have any clues? I’ll provide the login server’s main framework below.

try {
    shutdownClientHandler = false;
    clientListener = new java.net.ServerSocket(serverlistenerPort, 1, null);
    misc.println("Login server is now online!");
    while (true) {
    try {
        java.net.Socket s = clientListener.accept();
        s.setTcpNoDelay(true);
        String connectingHost = s.getInetAddress().getHostName();
        if (true) {
            if (checkLog("flooders", connectingHost)) {
                //misc.println("Flooder Detected, closing connection.");
                s.close(); // Closes the connection immediately.
            } else {
                connections.add(connectingHost);
                if (checkHost(connectingHost)) {
                    misc.println("Connection from "+connectingHost+":"+s.getPort());
                    try {
                        playerHandler.newPlayerClient(s, connectingHost);
                    } catch (Exception E) {misc.println("Login Server crash detected. Protecting...");
                    s.close();
                }
            } else {
                misc.println("ClientHandler: Rejected "+connectingHost+":"+s.getPort());
                s.close();
            }
        }
        } else {
            misc.println("ClientHandler: Rejected "+connectingHost+":"+s.getPort());
            s.close();
        }
        Thread.sleep(30;
    } catch (Exception e) {
        logError(e.getMessage());
    }
    }
} catch (java.io.IOException ioe) {
    if (!shutdownClientHandler) {
        misc.println("World is already online!");
    } else {
        misc.println("ClientHandler was shut down.");
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:57:12+00:00Added an answer on May 22, 2026 at 12:57 pm

    There are a few options to try to deal with a DDoS, but you need to make certain certain parts are optimized.

    For example, your checkLog function needs to be amazingly fast, so you may want to use a ‘hashmap’ perhaps, so you can quickly check, but, to ensure everything goes fast you may want to look at the ConcurrentHashMap (http://download.oracle.com/javase/1,5.0/docs/api/java/util/concurrent/ConcurrentHashMap.html), so you can better read and write to it.

    You could also look at load-balancing your front-end, so that one server isn’t having to do everything.

    Depending on what actions needs to be done on the server, find a quick way to verify that someone has been authenticated, but this could slow down your server if you don’t have special hardware to better handle decryption of a token, for example.

    You may also want to look at using NIO (http://tutorials.jenkov.com/java-nio/index.html), to better scale to a large number of connections.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.