⚡ Sangsakala Proxy 🏠 Home
Skip to content

Allow configuration of TCP keepalive for NIO TCP connections #420

Open

Description

@MarioGoupil

When dnsjava receives a truncated UDP response, it retries the query over TCP using NioTcpClient. That created TCP connection may remain open for reuse, but currently there is no way to configure TCP keepalive. A firewall or other network device may silently drop an idle connection, causing later queries that reuse it to fail.
Enabling SO_KEEPALIVE on NIO TCP connections and allowing callers to configure the keepalive timing and probe count would prevent that. Suggested system property names and defaults:

Property Default Socket option
dnsjava.tcp.keepalive true SO_KEEPALIVE
dnsjava.tcp.keepidle 900 seconds TCP_KEEPIDLE
dnsjava.tcp.keepinterval 75 seconds TCP_KEEPINTERVAL
dnsjava.tcp.keepcount 9 probes TCP_KEEPCOUNT

Activity

  1. ibauersachs commented on Oct 20, 2026

    @ibauersachs
    Member

    Thanks for the suggestion. While these settings might help, they go into territory of RFC7828 and should probably be implemented together. Would you mind contributing this with a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions