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 8939013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:44:53+00:00 2026-06-15T10:44:53+00:00

I’m writing a mod for a game(minecraft), for a friend. to do the specified

  • 0

I’m writing a mod for a game(minecraft), for a friend. to do the specified function of the mod I need to make sure a server is reachable within a certain time, I used InetAddress to do this but every time I use the command I get this error

2012-12-02 18:45:53 [INFO] [STDERR] java.net.UnknownHostException: addr is of illegal length
2012-12-02 18:45:53 [INFO] [STDERR]     at java.net.InetAddress.getByAddress(Unknown Source)
2012-12-02 18:45:53 [INFO] [STDERR]     at java.net.InetAddress.getByAddress(Unknown Source)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.src.CommandServSwitch.processCommand(CommandServSwitch.java:40)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.src.CommandHandler.executeCommand(CommandHandler.java:81)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.src.NetServerHandler.handleSlashCommand(NetServerHandler.java:715)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.src.NetServerHandler.handleChat(NetServerHandler.java:681)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.src.Packet3Chat.processPacket(Packet3Chat.java:60)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.src.MemoryConnection.processReadPackets(MemoryConnection.java:79)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.src.NetServerHandler.networkTick(NetServerHandler.java:82)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.src.NetworkListenThread.networkTick(NetworkListenThread.java:55)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.src.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:111)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:696)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:592)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.src.IntegratedServer.tick(IntegratedServer.java:110)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:499)
2012-12-02 18:45:53 [INFO] [STDERR]     at net.minecraft.src.ThreadMinecraftServer.run(ThreadMinecraftServer.java:17)

The method generating this error(and all the code you need to know):

    @Override
public void processCommand(ICommandSender var1, String[] var2) {
    if(var2.length < 1 || var2.length > 3) {
            throw new WrongUsageException("command.switch.usage", new Object[0]);
    }
    else {
             servport = Integer.parseInt(var2[1]);

            boolean ping = false;
            try {
                InetAddress IP = InetAddress.getByAddress(var2[0].getBytes());
                ping = IP.isReachable(400);
            } catch(UnknownHostException e) {
                e.printStackTrace();
            } catch(IOException e) {
                e.printStackTrace();
            }
  • 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-06-15T10:44:54+00:00Added an answer on June 15, 2026 at 10:44 am

    The docs for getByAddress say: “Returns an InetAddress object given the raw IP address. The argument is in network byte order: the highest order byte of the address is in getAddress()[0].”

                InetAddress IP = InetAddress.getByAddress(var2[0].getBytes());
    

    This line of code doesn’t make any sense. The string is not the raw IP address in network byte order as the function requires. Otherwise, it would be precisely four bytes long.

    You need to call InetAddress.getByName to convert from a text string, like foo.domain.com or 1.2.3.4 to internal binary format.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
In my XML file chapters tag has more chapter tag.i need to display chapters
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I am writing an app with both english and french support. The app requests

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.