Skip to content

EADDRINUSE on free port with wscat --listen #165

@pixel-prady

Description

@pixel-prady

When running wscat --listen --port 8080, I get the following error:

error: listen EADDRINUSE: address already in use --port

However, the port is actually free — I confirmed this with:

sudo lsof -iTCP:8080 -sTCP:LISTEN
# (no output)
python -m http.server 8080  # works fine

This happens even after killing all node processes (pkill -9 node)
It seems that wscat is incorrectly detecting the port as in use.

Environment:

OS: 
NAME="Fedora Linux"
VERSION="40 (Workstation Edition)"
ID=fedora
VERSION_ID=40
VERSION_CODENAME=""
PLATFORM_ID="platform:f40"
PRETTY_NAME="Fedora Linux 40 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:40"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f40/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=40
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=40
SUPPORT_END=2025-05-13
VARIANT="Workstation Edition"
VARIANT_ID=workstation


Node.js version: v24.3.0

wscat version: 6.1.0

Installed globally via npm
```
Notes:

This issue does not occur with Python’s http.server or other WebSocket servers on the same port.

Might be related to stale socket reuse or an IPv6/IPv4 binding conflict.

Workaround: using another tool like ws works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions