Download presentation
Presentation is loading. Please wait.
Published byLeslie Wells Modified over 9 years ago
7
Simplicity
9
Tile Update Notification Service Tile Update Notification Service SOAP Windows Communication Foundation Windows Web Services SOAP Windows Communication Foundation Windows Web Services Proximity Discovery Xbox LIVE Download/Uploa d Background Transfer Download/Uploa d Background Transfer OAuth SkyDrive Live ID Connected Accounts Live ID Connected Accounts Cost/Caps ConnectionCost Cost/Caps ConnectionCost Capabilities Sockets WebSockets Sockets WebSockets Offline HTML IndexedDB Application Cache DOM Storage File API Offline HTML IndexedDB Application Cache DOM Storage File API Syndication RSS AtomPub Syndication RSS AtomPub HTTP/REST Windows Communication Foundation XHR HttpClient HttpWebRequest IXHR HTTP/REST Windows Communication Foundation XHR HttpClient HttpWebRequest IXHR WebAuth Broker Microsoft Web Services High-level Foundational Helper Stream Data Reader+Writer Stream Data Reader+Writer Contracts Share, Settings, … Contracts Share, Settings, …
10
Tile Update Notification Service Tile Update Notification Service SOAP Windows Communication Foundation Windows Web Services SOAP Windows Communication Foundation Windows Web Services Proximity Discovery Xbox LIVE Download/Upload Background Transfer Download/Upload Background Transfer OAuth SkyDrive Live ID Connected Accounts Live ID Connected Accounts Cost/Caps ConnectionCost Cost/Caps ConnectionCost Capabilities Sockets WebSockets Sockets WebSockets Offline HTML IndexedDB Application Cache DOM Storage File API Offline HTML IndexedDB Application Cache DOM Storage File API Syndication RSS AtomPub Syndication RSS AtomPub HTTP/REST Windows Communication Foundation XHR HttpClient HttpWebRequest IXHR HTTP/REST Windows Communication Foundation XHR HttpClient HttpWebRequest IXHR WebAuth Broker Microsoft Web Services High-level Foundational Helper Stream Data Reader+Writer Stream Data Reader+Writer Contracts Share, Settings, … Contracts Share, Settings, …
12
TCP protocol Client StreamSocket TCP protocol Server StreamSocketListener UDP protocol Peer DatagramSocket WebSocket protocol (TCP-like) Client StreamWebSocket WebSocket protocol (UDP-like) Client MessageWebSocket Uses TCP or Bluetooth Peer ProximityStreamSocket
14
public static long GetMaxSocketSendSpeed(TcpClient client) { IPAddress ipAddress = ((IPEndPoint)client.Client.LocalEndPoint).Address; NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface adapter in adapters) { IPInterfaceProperties adapterProperties = adapter.GetIPProperties(); UnicastIPAddressInformationCollection addrInfos = adapterProperties.UnicastAddresses; foreach (UnicastIPAddressInformation addrInfo in addrInfos) { if (addrInfo.Address.Equals(ipAddress)) { return adapter.Speed; } return 0; }
16
Class relationships StreamSock et Control StreamSock et Control Remote HostName Remote HostName Bandwidth Statistics Bandwidth Statistics RoundTripTime Statistics RoundTripTime Statistics Network Item Connection Cost OutputStrea m InputStream Win32 and.NET Win32 only New in Win8 StreamSock et Information StreamSock et Information Local HostName Local HostName Network Adapter Network Adapter Connection Profile DataPlan Status DataPlan Usage DataPlan Usage StreamSock et
19
// using Windows.Networking; // using Windows.Networking.Sockets; var socket = new StreamSocket(); var hostName = new HostName("example.com"); string serviceName = "4554"; // Connect using regular TCP (no security). await socket.ConnectAsync(hostName, serviceName, SocketProtectionLevel.PlainSocket); // OPTIONAL: Enable SSL for security. await socket.ConnectAsync(hostName, serviceName, SocketProtectionLevel.Ssl);
20
RawName (input)DisplayNameCanonicalName Example.Com example.com Example.xn--p1aiExample.рфexample.рф 10.000.000.00110.0.0.1 0:0::1::1
22
// using Windows.Storage.Streams; var writer = new DataWriter(socket.OutputStream); // There’s Write*() APIs for a large number of types. writer.WriteInt32(42); await writer.StoreAsync(); // OPTIONAL: Set endian-ness (defaults to LittleEndian). writer.ByteOrder = ByteOrder.BigEndian;
23
// using Windows.Storage.Streams; var reader = new DataReader(socket.InputStream); // Read in exactly 4 bytes of data. await reader.LoadAsync(4); // There’s Read*() APIs for a large number of types. int number = reader.ReadInt32(); // Read in as many bytes as are available, up to 64K. reader.InputStreamOptions = InputStreamOptions.Partial; await reader.LoadAsync(64 * 1024);
24
// OPTIONAL: Close the socket. socket.Close();
26
Runtime streams integration
28
WebcamSocketEncrypt File Socket Mic File … Speakers Video control … Decrypt Compres s Decompre ss …
29
Proximity discovery
34
Windows.Networking.Proximity.PeerFinder.allowBluetooth = false; Windows.Networking.Proximity.PeerFinder.onpeerconnectprogress = peerConnectProgressEventHandler; Windows.Networking.Proximity.PeerFinder.start(); function peerConnectProgressEventHandler(ev) { if (ev.connectState == Windows.Networking.Proximity.PeerConnectState.connectComplete) { socket = ev.proximityStreamSocket; if (socket.information.LocalHostName.canonicalName < socket.information.RemoteHostName.canonicalName) { onStreamSocketConnected(); } else { onStreamSocketAccepted(); }
36
Web proxy traversal
37
Enterprise network Internet Web Proxy X
38
combine the best of both worlds. Web Sockets
40
// Create a TCP-like WebSocket. var socket = new StreamWebSocket(); // Connect to a URI. “wss” means use TLS to secure connection. await socket.ConnectAsync(new Uri(“wss://example.com/demo”)); // After this point, use the socket just like a StreamSocket. // OPTIONAL: Set any HTTP headers desired. socket.SetRequestHeader(“User-Agent”, “myapp”);
42
Review
43
Simplicity Streams Integration Proximity Discovery Web Proxy Traversal
44
[PLAT-785T] Creating connected apps that work on today's networks [PLAT-270T] Connecting and sharing with near field communication [SAC-807T] Building real-time web apps with WebSockets using IIS, ASP.NET and WCF [PLAT-373C] Building real-time web apps with HTML5 WebSockets [TOOL-588T] Debugging connected Windows 8 apps
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.