Skip to content

Listener shows active in UI when socket fails to open (address already in use) #142

@boexler

Description

@boexler

Summary

When starting a UDP listener on an address/port that is already in use (e.g. udp://0.0.0.0:4000), the application shows an error but the listener remains shown as "active" in the UI. The socket is not actually opened.

Expected behavior

  • If the listener fails to start (e.g. address already in use), the UI should:
    • Show a clear error message to the user.
    • Not mark the listener as "active"; it should reflect the real state (failed/not running).
  • The user should be able to retry or change the port without being stuck in an inconsistent state.

Actual behavior

  1. Error when starting listener on udp://0.0.0.0:4000:

    • Error message (German):
      Error starting listener on udp://0.0.0.0:4000: Normalerweise darf jede Socketadresse (Protokoll, Netzwerkadresse oder Anschluss) nur jeweils einmal verwendet werden.
    • (Roughly: "Usually each socket address (protocol, network address or port) may only be used once" — i.e. address/port already in use.)
  2. The listener could not start and the socket was not opened.

  3. Despite the failure, the listener stayed "active" in the UI, so the UI state did not match the real state (socket not open).

Proposed improvements

  1. Error handling: When the listener fails to start (e.g. socket bind error), ensure a user-visible error message is shown (and optionally logged).
  2. UI state: If the listener fails to start, do not set or keep the listener as "active" in the UI. The UI should show the listener as inactive/failed so the user can correct the configuration (e.g. change port) and retry.
  3. Recovery: Consider allowing the user to retry or edit the listener configuration without having to remove and re-add the listener.

Environment

  • Application: NLogViewer
  • Scenario: UDP listener, e.g. udp://0.0.0.0:4000 when port 4000 is already in use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions