Skip to content

Minecraft "Connection refused: getsockopt": What It Means and How to Fix It

"Connection refused: getsockopt" in Minecraft means nothing is listening on that port: server not started, port missing from the address, or a stale IP. Fixes in order.

Updated November 28, 2026
Minecraft

Connection refused: getsockopt is how Windows words an ordinary Minecraft connection refused. Your game found the address, sent a connection request, and the machine at the other end answered that nothing was accepting connections on that port. The word getsockopt adds nothing: it is a leftover label in Java's Windows networking code, not a separate fault.

So the fix is the same as for any refused connection, and in almost every case it is one of four things:

  1. The server is not running yet, or crashed while starting.
  2. The port is missing or wrong in the address you typed.
  3. The address points at the wrong machine, often an old IP saved in the server list or an out-of-date domain record.
  4. You are using the wrong edition's port, for example a Java client aimed at a Geyser port.

Work through the checks below in that order.

What the Error Says, Piece by Piece

On a Java Edition client the disconnect screen shows Failed to connect to the server, with the underlying error underneath:

io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: getsockopt: play.example.com/203.0.113.10:25565
text
Part What it means
AnnotatedConnectException Netty, the networking library Minecraft uses, wrapping Java's normal "could not connect" exception and adding the address to it
Connection refused The request reached a machine, and that machine said no one is listening on that port. This is the part that matters
getsockopt A label left in Java's Windows code. It does not name the cause
play.example.com/203.0.113.10:25565 The name you typed, the IP it resolved to, and the port the game actually tried

Read the end of that line before anything else. The IP and port there are what the game really used. If the port is 25565 and your server's port is something else, you have already found the problem.

Why It Says "getsockopt" (and Not Everyone Sees It)

The wording depends on your operating system and Java build, not on the server:

Where the client runs How the same refusal is worded
Windows, with Java 17.0.11+, 21.0.2+ or 22 and newer Connection refused: getsockopt
Windows, with older Java builds Connection refused: no further information
Linux and macOS, Minecraft 26.3 finishConnect(..) failed with error(...), then Connection refused

This is documented in the OpenJDK bug tracker. Bug JDK-8317603 changed Windows socket error messages in JDK 22. It was backported to 21.0.2 and 17.0.11, and that change is where the getsockopt text came from. A later bug, JDK-8376290, says the text is confusing because "it's the connect operation that has failed and not getsockopt". It removes the label in JDK 27, so the message will read plain Connection refused.

Minecraft 1.20.5 and later ship with Java 21, and every release from 26.1 ships with Java 25. Per Mojang's version manifest, 26.3 uses Java 25. So almost every Windows player on a current version sees getsockopt. Guides that call getsockopt and no further information two different errors are describing one error in two Java versions.

Refused Is Not the Same as Timed Out

These are the two most common connection failures, and they mean opposite things:

Message What happened Where to look
Connection refused (with or without getsockopt) Something answered and said no Right machine, wrong port, or the server isn't running
Connection timed out Nothing answered at all Wrong IP, or a firewall dropping traffic
Unknown host / Can't resolve hostname The name could not be turned into an address Spelling, or a missing DNS record

A refusal is the more useful of the three. It proves your network reached a real machine. That rules out most firewall, router and ISP theories before you start.

Fix 1: Make Sure the Server Has Finished Starting

A server that is stopped, restarting or still booting has nothing listening on its port, so every join gets refused. Open your server's Console tab and look for the line every Java server prints when startup is complete:

[Server thread/INFO]: Done (18.412s)! For help, type "help"
Console output

Until that line appears, refusals are expected. On a big modpack, first boot can take several minutes. If the console stops before Done, or ends in a stack trace, the server is failing to start. That is a startup problem, not a connection problem. Reading Minecraft Server Logs and Crash Reports shows how to find the cause, and Minecraft Server Won't Start covers the common ones.

Right after a restart, wait for Done

A player who joins in the seconds after you click Restart gets a refusal even though nothing is wrong. Try again once the console shows Done.

Fix 2: Put the Port in the Address

This is a common cause on hosted servers. When you type an address without a port, Minecraft uses the default port, 25565. On our plans the port your server was given is often a different number, so the bare IP reaches the right machine but the wrong port. You get exactly this refusal.

  1. Open the Console tab and copy the Address shown at the top left. It is both halves, IP:PORT, for example 203.0.113.10:25566.
  2. In Minecraft, go to Multiplayer, select the old entry and click Edit (or Delete it and use Add Server).
  3. Paste the full address, port included, into Server Address and click Done.

Don't try to "fix" the port by editing server-port in server.properties. Your server is bound to the allocation shown on the Network tab, and the panel writes that port into the file when the server starts. Changing it by hand does not move the server. Minecraft server.properties: The Complete Reference has the details.

A custom domain hides the port only if it has an SRV record

play.example.com without a port only works on a port other than 25565 if the domain has an SRV record pointing at the right port. If you set up a domain and players get refused, check that record first. How to Give Your Server a Custom Address covers the record and how to test it.

Fix 3: Check the Address Points at Your Server Now

The game connects to the address that was saved, not necessarily the current one. Read the IP at the end of the error message and compare it with the Address on your Console tab.

  • A stale server-list entry. If your server was moved, the saved entry may still point at the old IP. Delete it and add the server again from the current address.
  • A domain that still points at the old IP. DNS records don't follow your server when it moves. Update the A record, and the SRV record if you use one.
  • The wrong IP from a screenshot or Discord message. It happens more than you'd think. Copy the address from the panel rather than retyping it.

Fix 4: Use the Java Port From a Java Client

Java and Bedrock are separate games on separate transports. Java connects over TCP, by default on port 25565. Bedrock plays over UDP, by default on 19132. A Java client aimed at a UDP-only port finds no TCP listener there, and the result is usually a refusal. Newer Bedrock and Geyser builds also open a TCP port for their handshake. A Java client still can't join through it, but it may show a different error.

When Only One Player Gets the Error

If everyone else can join, the server is listening and the problem is in that player's saved entry or connection.

  1. Have them delete the server entry and add it again, pasting the full IP:PORT. An entry saved before a port change or server move is a common cause.
  2. Compare the IP and port at the end of their error with the Address on your Console tab. If they differ, their entry is wrong.
  3. Try another network. Thirty seconds on a phone hotspot tells you whether their home network is involved. A refusal from somewhere other than your server is rare, but some VPNs and security tools that intercept traffic can produce one.

If You Are Hosting on Your Own PC

The same rules apply to a server running at home, with one more layer:

  • On the same machine, connect to localhost (plus the port, if you changed it). A refusal there means the server isn't running or is on another port.
  • From outside your house, friends need your public IP and a port-forward on your router to the PC running the server. Without a forward, the router either drops the traffic (a timeout) or refuses it, depending on the model.

That router step is the part a hosted server removes, along with keeping a PC on all the time. How to Play Minecraft Multiplayer With Friends compares LAN, Realms and running your own Minecraft server.

What to Send Support

If none of this explains it, open a ticket with:

  1. The full error line, including the IP and port at the end. A screenshot is ideal.
  2. The Address from your Console tab.
  3. Whether it is every player or just one.
  4. Whether the Console tab shows the Done (…)! line, and the last twenty lines of console output.

Made with 💜 by GameServerKings

Need a Minecraft server?

Deploy an instantly-provisioned Minecraft server on high-clock hardware. DDoS protected, no contracts, cancel anytime.

From $4.80 /month