Skip to content

fix(onvif): make WS-Discovery work on Android/iOS#14

Open
keyldev wants to merge 1 commit into
mainfrom
fix/onvif-discovery-android-platform-not-supported
Open

fix(onvif): make WS-Discovery work on Android/iOS#14
keyldev wants to merge 1 commit into
mainfrom
fix/onvif-discovery-android-platform-not-supported

Conversation

@keyldev

@keyldev keyldev commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

Onvif.Core's UdpClientWrapper calls IPGlobalProperties.GetActiveTcpListeners() in its ctor — unimplemented on mobile, so discovery threw Arg_PlatformNotSupported before sending a probe.

  • add PlatformSafeUdpClient (IUdpClient) that skips that pre-check, binds an ephemeral UDP socket and sends the multicast probe; replies are unicast so no multicast-group join / Android MulticastLock is needed
  • WsDiscoveryService uses it instead of UdpClientWrapper

Summary

Onvif.Core's UdpClientWrapper calls IPGlobalProperties.GetActiveTcpListeners() in its ctor — unimplemented on mobile, so discovery threw Arg_PlatformNotSupported before sending a probe.

  • add PlatformSafeUdpClient (IUdpClient) that skips that pre-check, binds an ephemeral UDP socket and sends the multicast probe; replies are unicast so no multicast-group join / Android MulticastLock is needed
  • WsDiscoveryService uses it instead of UdpClientWrapper

Related

Type

  • Bug fix
  • Feature
  • Refactor / cleanup
  • Docs / CI
  • Other:

Checklist

  • Builds with 0 warnings (TreatWarningsAsErrors=true).
  • Tests pass (dotnet test); new Core logic has unit tests.
  • No layering violation — App references Core only (Infrastructure / Video / Devices wired via DI in a head).
  • Scope stays within one phase (didn't pull work from a later phase's "Не входит").
  • README / docs updated if public commands, options, or setup changed.

Platforms tested

  • Windows
  • Linux
  • macOS
  • Android
  • iOS
  • CI build only

Screenshots / notes

Onvif.Core's UdpClientWrapper calls IPGlobalProperties.GetActiveTcpListeners()
in its ctor — unimplemented on mobile, so discovery threw Arg_PlatformNotSupported
before sending a probe.

- add PlatformSafeUdpClient (IUdpClient) that skips that pre-check, binds an
  ephemeral UDP socket and sends the multicast probe; replies are unicast so
  no multicast-group join / Android MulticastLock is needed
- WsDiscoveryService uses it instead of UdpClientWrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant