Skip to content

PortBindErrors

Static class in Oadm.Sdk.Network · Oadm.Sdk.dll

Maps a failed bind of a service port (NTP 123, DHCP 67) per OS and builds the shared parts of the status texts. Windows has no privileged ports: AccessDenied there means another socket holds the port exclusively, so it is “in use” like EADDRINUSE. Linux needs root or capabilities below 1024; macOS needs root for a single address.

public static class PortBindErrors
static BindErrorKind Classify(SocketError error, HostOs os)

What a failed bind with error means on os.

static string FindUdpPortOwner(HostOs os, int port, string? usualSuspects = null)

How to find the program that holds a UDP port, per OS.

Parameters

  • os: Server OS.
  • port: The port.
  • usualSuspects: “often chronyd or ntpd”; appended in brackets on Linux and macOS when given.
static string InUseText(int port)

“Port 67 is in use by another program”.

static string OtherText(int port, SocketError error)

“Cannot use port 67: NetworkDown”.

static string PermissionFix(HostOs os, string capabilities = "cap_net_bind_service", string? macOsAlternative = null)

How to allow a port below 1024, per OS.

Parameters

  • os: Server OS.
  • capabilities: Linux capabilities to grant, e.g. “cap_net_bind_service”.
  • macOsAlternative: macOS: an alternative to sudo (“, or choose "All interfaces"”).
static string PermissionText(int port)

“Insufficient permission to use port 67”.