session 200 - core os networking
TRANSCRIPT
-
8/3/2019 Session 200 - Core OS Networking
1/45
Overview
Brett R. Halle
Senior Director, CoreOS
2
-
8/3/2019 Session 200 - Core OS Networking
2/45
3
-
8/3/2019 Session 200 - Core OS Networking
3/45
You are here
4
-
8/3/2019 Session 200 - Core OS Networking
4/45
5
-
8/3/2019 Session 200 - Core OS Networking
5/45
One year, one month, 28 days left
New support, stack synchronized with Snow Leopard
Automatically obtains IPv6 prefix/address via router advertisement
DHCPv6 (stateless) for DNS server addresses, search domains, etc.
Most apps IPv6 ready to go!
6
-
8/3/2019 Session 200 - Core OS Networking
6/45
One year, one month, 27 days left
Stack, socket interface, CFNetwork IPv6 ready
If youre using CFNetwork, you may be done!Test your app with v6
If youre not using CFNetwork, be aware!
Check your older source code
7
-
8/3/2019 Session 200 - Core OS Networking
7/45
One year, one month, 26 days left
Write code for address independence Be aware of displaying/storing IP addresses, may be 128bits now
Use address independent hostname lookups (getaddrinfo)Expect multiple addresses (some IPv4, some IPv6)
Use sockaddrs NOT in_addr/in6_addr
Reorder socket / gethostbyname / connectto getaddrinfo / socket / connect
If your app listens for connections, listen for IPv6 only
Avoid using functions/structures that are IPv4 specific
8
-
8/3/2019 Session 200 - Core OS Networking
8/45
What is a captive network?
OS detects and rememberscaptive networks
Wi-Fi interface is unavailablewhile captive
New support for Hotspotmanagement apps
9
-
8/3/2019 Session 200 - Core OS Networking
9/45
Cisco and Juniper clients
OS Level plumbing
Vendor specific feature sets
Available via the App Store
10
-
8/3/2019 Session 200 - Core OS Networking
10/45
Networking behavior for background apps
When suspended: Networking sockets will persist for an arbitrary time
System may reclaim resources associated with socket
Be sure to respond to going to background notification
Respond to networking errors Read the documentation for various use-cases (e.g., VoIP)
See sessions: Adopting Multitasking on iPhone OS, Part 1
Adopting Multitasking on iPhone OS, Part 2
Simplifying Networking Using Bonjour
11
-
8/3/2019 Session 200 - Core OS Networking
11/45
12
-
8/3/2019 Session 200 - Core OS Networking
12/45
225,000+ apps
Significant percentage arenetwork enabled
Mobility isnt the exception,its the norm
4
13
-
8/3/2019 Session 200 - Core OS Networking
13/45
System administrators configured
everythingTotal control of your local networkingenvironment
14
-
8/3/2019 Session 200 - Core OS Networking
14/45
Network configuration is
completely dynamic andcan be assumed to change
At any time and for virtuallyany reason
Signal strength Cell availability
Wi-Fi availability
Public and privateWi-Fi environments
VPN connectivity
15
-
8/3/2019 Session 200 - Core OS Networking
15/45
16
-
8/3/2019 Session 200 - Core OS Networking
16/45
Things to remember while writing the next great app
17
-
8/3/2019 Session 200 - Core OS Networking
17/45
18
-
8/3/2019 Session 200 - Core OS Networking
18/45
Usage may be charged
by time or amount 3G and/or Wi-Fi may be fee-based
3G may be roaming
Transmit only what you need to
Cache intelligently
19
-
8/3/2019 Session 200 - Core OS Networking
19/45
20
-
8/3/2019 Session 200 - Core OS Networking
20/45
Connections will go downbe prepared
Packets will get dropped
Timeouts will occur
Respond to backgrounding intelligently
Close things down that you can
21
-
8/3/2019 Session 200 - Core OS Networking
21/45
22
-
8/3/2019 Session 200 - Core OS Networking
22/45
Do NOT put synchronous
calls on main thread Your app will get shot!
Event-driven APIs give abetter experience
(e.g., Bonjour, FoundationAPIs using RunLoop eventsources, etc.)
UI should reflect this reality
23
-
8/3/2019 Session 200 - Core OS Networking
23/45
24
-
8/3/2019 Session 200 - Core OS Networking
24/45
Wi-Fi
3G
Layered networks (Wi-Fi on cellular or worse)
Expect changes in
Speed Latency
Packet loss
25
-
8/3/2019 Session 200 - Core OS Networking
25/45
26
-
8/3/2019 Session 200 - Core OS Networking
26/45
Network wont always be available
Might go away at any time Your app should behave intelligentlygracefully
27
-
8/3/2019 Session 200 - Core OS Networking
27/45
28
-
8/3/2019 Session 200 - Core OS Networking
28/45
May be using public Wi-Fi, Hotspots, etc. Might even be using spoofed network
Do not transmit user information inthe clear
Use end-to-end security, TransportLevel Security (TLS), whenever possible
29
-
8/3/2019 Session 200 - Core OS Networking
29/45
30
-
8/3/2019 Session 200 - Core OS Networking
30/45
Use CFNetwork and higher,
when possible Dont assume address typesor sizes
Be prepared for multiple DNS
address resolution responses Check open source and oldercode for v6 compatibility
31
-
8/3/2019 Session 200 - Core OS Networking
31/45
32
-
8/3/2019 Session 200 - Core OS Networking
32/45
Its a dynamic world; nobody remembers
IP addresses Can you remember your IPv6 address?(2001:0200:0000:8002:0203:47ff:fea5:3085)
Bonjour provides service advertisement,
browsing, and resolving APIs Peer-to-peer
On desktop OS, Bonjour also providessleep proxy support
See session: Simplifying Networking Using Bonjour
33
-
8/3/2019 Session 200 - Core OS Networking
33/45
34
-
8/3/2019 Session 200 - Core OS Networking
34/45
Portability means batteries
Dont power up the radio(s) more thanyou need to
Use push notifications
Sleep proxy support helps on Snow Leopard
35
-
8/3/2019 Session 200 - Core OS Networking
35/45
36
-
8/3/2019 Session 200 - Core OS Networking
36/45
Anything can and WILL change Available interfaces Signal strength and quality
Dont leave connections openlonger than necessary
Use Reachability APIs NOT a preflight check
Change notifications
37
-
8/3/2019 Session 200 - Core OS Networking
37/45
Network Apps for iPhone OS, Part 1 Pacific HeightsWednesday 2:00PM
Network Apps for iPhone OS, Part 2 MarinaWednesday 3:15PM
Simplifying Networking Using Bonjour Nob HillWednesday 10:15AM
Adopting Multitasking on iPhone OS, Part 1Presidio
Tuesday 11:30AM
Adopting Multitasking on iPhone OS, Part 2 MissionTuesday 3:15PM
38
-
8/3/2019 Session 200 - Core OS Networking
38/45
Networking Lab Core OS Lab ATuesday 4:30PM
Networking Lab Core OS Lab BWednesday 9:00AM
Networking Lab Core OS Lab BThursday 9:00AM
39
-
8/3/2019 Session 200 - Core OS Networking
39/45
Networked apps add value for your customers
They expect a connected experience Be prepared for the challenges of the mobile world
40
-
8/3/2019 Session 200 - Core OS Networking
40/45
41
-
8/3/2019 Session 200 - Core OS Networking
41/45
Paul DanboldEvangelist
DocumentationNetworkinghttp://developer.apple.com/networking/
Apple Developer Forumshttp://devforums.apple.com
42
-
8/3/2019 Session 200 - Core OS Networking
42/45
Network Apps for iPhone OS, Part 1 Pacific HeightsWednesday 2:00PM
Network Apps for iPhone OS, Part 2 MarinaWednesday 3:15PM
Simplifying Networking Using Bonjour Nob HillWednesday 10:15AM
Adopting Multitasking on iPhone OS, Part 1
Presidio
Tuesday 11:30AM
Adopting Multitasking on iPhone OS, Part 2 MissionTuesday 3:15PM
43
-
8/3/2019 Session 200 - Core OS Networking
43/45
Networking Lab Core OS Lab ATuesday 4:30PM
Networking Lab Core OS Lab BThursday 9:00AM
Networking Lab Core OS Lab BFriday 9:00AM
44
-
8/3/2019 Session 200 - Core OS Networking
44/45
-
8/3/2019 Session 200 - Core OS Networking
45/45
46