GCXMulticastDNSKit 1.3.1

GCXMulticastDNSKit 1.3.1

测试已测试
语言语言 SwiftSwift
许可证 Apache-2.0
发布上次发布2020 年 9 月
SPM支持 SPM

Christian NetthöfelPaul EhrhardtJan Rose (GCX)Paul Ehrhardt 维护。



GCXMulticastDNSKit

License Release Carthage compatible Cocoapods compatible

iOS 的组播 DNS 框架

概述

GCXMulticastDNSKit 是一个框架,可以用来发现本地网络上发布的服务。它是 Apple 提供的网络服务的包装器。

介绍

mDNS 是一种在本地网络上解析主机名的服务,而不需要使用中心域名服务器。相反,解析主机简单地向本地多播地址发送 DNS 查询,然后具有该名称的主机通过具有其 IP 地址的多播消息进行响应。多播 DNS 也与基于 DNS 的服务发现结合使用,其中提供网络服务的主机可以将其服务宣布到本地网络。这些服务可以使用多播消息进行发现。

请参阅:[1] 多播DNS [2] Zeroconf 服务发现

此框架目前提供功能,用于基于服务类型和服务名称在本地网络中发现服务。

安装

CocoaPods

use_frameworks!

pod 'GCXMulticastDNSKit', :git => 'https://github.com/grandcentrix/GCXMulticastDNSKit.git', :tag => 'v1.3.1'

Carthage

git "https://github.com/grandcentrix/GCXMulticastDNSKit.git" ~> 1.3.1

用法

要使用此框架,我们假设您知道服务的类型(例如 _ptp._tcp 是 PTP/IP 服务的有效服务类型,另一个示例是 _http._tcp)。因为有多个服务可能提供功能,所以您还可以指定一个可选的服务名称前缀,该前缀必须与提供的名称匹配。在下面的示例中,我们正在寻找来自供应商 A 兼容的 PTP 相机。它们用一个 PTP 服务类型和一个服务名称 Vendor A (#序列号) 进行了声明。我们想找到本地网络上所有 VendorA 相机,所以我们使用 _ptp._tcp 作为服务类型,以及 Vendor A 作为服务名称前缀

let configurations = [DiscoveryConfiguration(serviceType: "_ptp._tcp",
                                           serviceNamePrefix: "Vendor A")]

discovery = Discovery(with: configurations, delegate: self)
discovery?.startDiscovery()

许可

Copyright 2017 grandcentrix GmbH

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   https://apache.ac.cn/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.