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
-
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.)
-
The listener could not start and the socket was not opened.
-
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
- Error handling: When the listener fails to start (e.g. socket bind error), ensure a user-visible error message is shown (and optionally logged).
- 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.
- 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.
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
Actual behavior
Error when starting listener on
udp://0.0.0.0:4000:Error starting listener on udp://0.0.0.0:4000: Normalerweise darf jede Socketadresse (Protokoll, Netzwerkadresse oder Anschluss) nur jeweils einmal verwendet werden.The listener could not start and the socket was not opened.
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
Environment
udp://0.0.0.0:4000when port 4000 is already in use.