Skip to content

ncat exits after idling for 2 minutes on Windows #3291

@stdc105

Description

@stdc105

Describe the bug
On Windows, ncat connecting to a localhost TCP server will exit after 2 minutes of no packets being exchanged. When the connection dies, WireShark reports that ncat sends a [RST, ACK] packet, and ncat exits with an error of "Ncat: An existing connection was forcibly closed by the remote host. ." When there are packets sends to and/or received from the server, the connection seems to be stable.

This 2 minute problem persists even if ncat is run with -i 1h and/or -w 300s options (the initial connection wasn't an issue in this case anyway).

To Reproduce

  1. On a windows machine, open a python interpreter, start a TCP server by import socketserver; s = socketserver.TCPServer(("127.0.0.1", 59595), None)
  2. Run ncat in Git Bash or Powershell: ncat 127.0.0.1 59595
  3. Wait for 2 minutes
  4. "Ncat: An existing connection was forcibly closed by the remote host. ."

Expected behavior
When not specifying -i 2m, I would expect Ncat to not exit abruptly or at least keep running for a reasonable time. When running $client = New-Object System.Net.Sockets.TcpClient("127.0.0.1", 6005) in powershell, the connection is kept for more than 5 minutes until I ran $client.close().

Version info (please complete the following information):

  • OS: Windows 11 Pro (10.0.26200)
  • Output of ncat --version: Ncat: Version 7.98 ( https://nmap.org/ncat )

Additional context
This problem originates from a dive when experimenting with Godot Game Engine + Zed Editor, where the zed-gdscript plugin is using ncat to communicate with the GDScript language server. There are a couple of issues mentioning this ( GDQuest/zed-gdscript#68 and godotengine/godot#113449 ) so I did a little troubleshooting to see how far could I go. Please let me know if there is something I have overlooked or if there is any more information I can provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions