23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

servers. In those cases—such as file sharing, media servers, VoIP, chat, multiplayer/multicast games, and<br />

other bi-directional scenarios involving incoming network traffic, as with sockets—the app must declare<br />

the Internet (Client & Server) capability, as shown in Figure 14-1. This lets such traffic through the<br />

inbound firewall, though critical ports are always blocked.<br />

There is also network traffic that occurs on a private network, as in a home or business, where the<br />

Internet isn’t involved at all. For this there is also the Private Networks (Client & Server) capability, also<br />

shown in Figure 14-1, which is good for file or media sharing, line-of-business apps, HTTP client apps,<br />

multiplayer games on a LAN, and so on. What makes any given IP address part of this private network<br />

depends on many factors, all of which are described on How to configure network isolation capabilities.<br />

For example, IPv4 addresses in the ranges of 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, and<br />

192.168.0.0–192.168.255.255 are considered private. Users can flag a network as trusted, and the<br />

presence of a domain controller makes the network private as well. Whatever the case, if a device’s<br />

network endpoint falls into this category, the behavior of apps on that device is governed by this<br />

capability rather than those related to the Internet.<br />

FIGURE 14-1 Additional network capabilities in the manifest.<br />

Sidebar: Localhost Loopback<br />

Regardless of the capabilities declared in the manifest, local loopback—that is, using<br />

http://localhost URIs—is blocked for Windows Store apps. An exception is made for machines on<br />

which a developer license has been installed, as described in Chapter 13, “Tiles, Notifications, the<br />

Lock Screen, and Background Tasks,” in the section “Using the Localhost.” This exception exists<br />

only to simplify debugging apps and services together, because they can all be running on a<br />

single machine during development.<br />

Network Information (the Network Object Roster)<br />

Regardless of the network involved, everything you want to know about that network is available<br />

through the Windows.Networking.Connectivity.NetworkInformation object. Besides a single<br />

632

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!