Beispiel #1
0
        /// <summary>
        ///     Resolves available ZeroConf services
        /// </summary>
        /// <param name="options"></param>
        /// <param name="callback">Called per record returned as they come in.</param>
        /// <param name="netInterfacesToSendRequestOn">The network interfaces/adapters to use. Use all if null</param>
        /// <returns></returns>
        public static async Task <IReadOnlyList <IZeroconfHost> > ResolveAsync(ResolveOptions options,
                                                                               Action <IZeroconfHost> callback     = null,
                                                                               CancellationToken cancellationToken = default(CancellationToken),
                                                                               System.Net.NetworkInformation.NetworkInterface[] netInterfacesToSendRequestOn = null)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
#if !__IOS__
            return(await ResolveAsyncOriginal(options, callback, cancellationToken, netInterfacesToSendRequestOn));
#else
            if (UIDevice.CurrentDevice.CheckSystemVersion(14, 5))
            {
                if (UseBSDSocketsZeroconfOniOS)
                {
                    return(await ResolveAsyncOriginal(options, callback, cancellationToken, netInterfacesToSendRequestOn));
                }
                else
                {
                    return(await ZeroconfNetServiceBrowser.ResolveAsync(options, callback, cancellationToken, netInterfacesToSendRequestOn));
                }
            }
            else
            {
                return(await ResolveAsyncOriginal(options, callback, cancellationToken, netInterfacesToSendRequestOn));
            }
#endif
        }
Beispiel #2
0
        Task <IReadOnlyList <string> > GetiOSDomains(TimeSpan scanTime = default(TimeSpan),
                                                     CancellationToken cancellationToken = default(CancellationToken))
        {
#if __IOS__
            var domainList = new List <string>();

            if (UIDevice.CurrentDevice.CheckSystemVersion(14, 5) && !UseBSDSocketsZeroconfOniOS)
            {
                domainList.AddRange(await ZeroconfNetServiceBrowser.GetDomains((scanTime != default(TimeSpan)) ? scanTime : TimeSpan.FromSeconds(2), cancellationToken));
            }
            return(domainList);
#else
            return(Task.FromResult((IReadOnlyList <string>) new List <string>()));
#endif
        }