Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Zero Configuration
Search
Yuji Taniguchi
August 20, 2018
Technology
1
170
Zero Configuration
Zero Configuration on Apple Platform
Yuji Taniguchi
August 20, 2018
Tweet
Share
More Decks by Yuji Taniguchi
See All by Yuji Taniguchi
Zeroconf on iOS
natpenguin
2
1.2k
The ownership in iOS
natpenguin
0
340
Other Decks in Technology
See All in Technology
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
32k
5分でわかるDuckDB
chanyou0311
10
3.3k
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
300
DevFest 2024 Incheon / Songdo - Compose UI 조합 심화
wisemuji
0
160
LINEヤフーのフロントエンド組織・体制の紹介【24年12月】
lycorp_recruit_jp
0
550
WACATE2024冬セッション資料(ユーザビリティ)
scarletplover
0
330
[JAWS-UG新潟#20] re:Invent2024 -CloudOperationsアップデートについて-
shintaro_fukatsu
0
120
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
160
OCI技術資料 : ファイル・ストレージ 概要
ocise
3
11k
宇宙ベンチャーにおける最近の情シス取り組みについて
axelmizu
0
120
podman_update_2024-12
orimanabu
1
290
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
290
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
1
110
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Cult of Friendly URLs
andyhume
78
6.1k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Docker and Python
trallard
42
3.2k
Gamification - CAS2011
davidbonilla
80
5.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Unsuck your backbone
ammeep
669
57k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Transcript
Zero Configuration Nagoya iOS meetup Vol. 4
Introduction • Software Engineer at merpay • Twitter : @_natpenguin
• GitHub : natpenguin
Agenda • What is the Zero Configuration? • Zero Configuration
on Apple Platform • Coding on iOS
Zero Configuration Networking (Zeroconf)
Zero Configuration Networking connecting
Zero Configuration Networking connected
Zeroconf • Avahi (Linux / BSD) • Bonjour • Windows
CE 5.0 (LLMNR) • UPnP • AirPlay / AirPrint • DLNA …
Application developer IP Address Domain Don’t need to know
Bonjour
History
AppleTalk
AppleTalk • 1984 • Published phase 2 1989 • Internet(TCP/IP)
• Rendezvous on Mac OS X Jaguar(v10.2) 2002 • Bonjour on Mac OS X Tiger(v10.4) 2005 • Deleted from Mac OS X Snow Leopard(v10.6) 2009
Coding
Server NetService
Server let domain = "local." let type = “_awesome._tcp." let
name = "Awesome Service" let port: Int32 = 10000
Server let domain = "local." let type = “_awesome._tcp." let
name = "Awesome Service" let service = NetService(domain: domain, type: type, name: name, port: port) let port: Int32 = 10000
Server let domain = "local." let type = “_awesome._tcp.” let
name = "Awesome Service" service.publish() let service = NetService(domain: domain, type: type, name: name, port: port) let port: Int32 = 10000
https://www.iana.org/assignments/ service-names-port-numbers/ service-names-port-numbers.xhtml Type
Client NetServiceBrowser
Client let domain = "local." let type = “_awesome._tcp."
Client let domain = "local." let type = “_awesome._tcp." browser.searchForServices(ofType:
type, inDomain: domain)
Client browser.searchForServices(ofType: type, inDomain: domain) func netServiceBrowser(_ browser: NetServiceBrowser, didFind
service: NetService, moreComing: Bool) let domain = "local." let type = “_awesome._tcp."
Client extension ViewController: NetServiceBrowserDelegate { func netServiceBrowser(_ browser: NetServiceBrowser, didFind
service: NetService, moreComing: Bool) { // do something... } }
Client browser.delegate = self browser.searchForServices(ofType: type, inDomain: domain) extension ViewController:
NetServiceBrowserDelegate { func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) { // do something... } }
Client extension ViewController: NetServiceBrowserDelegate { func netServiceBrowser(_ browser: NetServiceBrowser, didFind
service: NetService, moreComing: Bool) { service.resolve(withTimeout: 10.0) } }
Client extension ViewController: NetServiceBrowserDelegate { func netServiceBrowser(_ browser: NetServiceBrowser, didFind
service: NetService, moreComing: Bool) { service.resolve(withTimeout: 10.0) } } func netServiceDidResolveAddress(_ sender: NetService)
Client extension ViewController: NetServiceDelegate { func netServiceDidResolveAddress(_ sender: NetService) {
// do something... } } service.resolve(withTimeout: 10.0) service.delegate = self
Client more BSD Socket CFSocket NSStream
Command $ dns-sd -B <Type> $ dns-sd -L <Service Name>
<Type> <Domain> $ dns-sd -G <protocol> <Hostname> $ dns-sd -H Browsing Resolving a service instance Getting IP Address Help
Command $ dns-sd -B _printer._tcp Browsing a printer service
Command $ dns-sd -B _printer._tcp Browsing a printer service Browsing
for _printer._tcp DATE: ---Mon 20 Aug 2018--- 3:21:58.151 ...STARTING... Timestamp A/R Flags if Domain Service Type Instance Name 3:21:58.151 Add 2 8 local. _printer._tcp. Printer Service
iOS12
Network.framework
Network.framework let name = "Awesome Service" let type = "_awesome._tcp."
let domain = "local." let parameters = NWParameters.tcp let port = NWEndpoint.Port(integerLiteral: 10000) listener.service = NWListener.Service(name: name, type: type, domain: domain) guard let listener = try? NWListener(using: parameters, on: port) else { fatalError("Listener can't be initialized") }
Let’s enjoy