Skip to content

[ TCP Port Conflict ] Modflared always uses the same port, if this port is already used, a connection to a server always returns an error #94

@fpicarras

Description

@fpicarras

Describe the bug
Unable to connect to server when the port cloudflared uses to bind the TCP sockets is already in use. I know this is very specific but i have an application that manages the motherboard that uses an internet port for internal communication, thus i can't change it. And i got really unlucky with the port that the cloudflared is using to connect...

Which version of the mod/game are you using?
NeoForge 1.21.1 - modflared 1.2.2+release.81

To Reproduce
Steps to reproduce the behavior:

  1. Start game
  2. Have another application using port X
  3. Attempt to connect to server
  4. Get the error:
    [Server Pinger Can someone make an indepth .README file  #2/INFO][modflared/]: Starting tunnel to example.domain.com
    [pool-27-thread-5/INFO][modflared/]: [cloudflared-windows-amd64.exe access tcp --hostname example.domain.com --url 127.0.0.1:26822]
    [pool-27-thread-5/INFO][Cloudflared/]: 2026-04-06T10:09:07Z INF Start Websocket listener host=127.0.0.1:26822
    [pool-27-thread-5/INFO][Cloudflared/]: 2026-04-06T10:09:07Z ERR Error on Websocket listener error="failed to start forwarding server: listen tcp 127.0.0.1:26822: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted."
    [pool-27-thread-5/INFO][Cloudflared/]: failed to start forwarding server: listen tcp 127.0.0.1:26822: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
    [Netty Client IO fix: macOS cloudflared updated #11/INFO][modflared/]: Stopping tunnel to /127.0.0.1:26822
    [Render thread/ERROR][net.minecraft.client.multiplayer.ServerStatusPinger/]: Can't ping example.domain.com: Internal Exception: java.net.SocketException: Connection reset

Expected behavior
The mod should be able to catch this error and attempt another port to bind the TCP socket.

Screenshots

Additional context
Using Windows 11 (latest version as of 6th of April)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions