Specifying the Secure Device Association Templates for your App

Use your app manifest to specify the secure device association templates that your app will use for network communication.

Specifying networking parameters

To use the secure sockets API, you must specify your app’s socket and port usage, network traffic patterns, security requirements, and other static networking configuration information, in your app manifest. These settings are specified in the XboxNetworkingManifest node.

Example of networking parameters in an app manifest

The following example of a manifest provides the parameters for instantiation of a SecureDeviceSocketDescription object, with the arbitrarily chosen port number 43210, by specifying common usage types in mx:SocketDescription. It then provides the parameters for a SecureDeviceAssociationTemplate object that references that socket description as both the initiator and the acceptor, a common pattern for apps that can behave as both a client and a server that use a single UDP socket.

      <?xml version="1.0" encoding="utf-8"?>
      <Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:mx="http://schemas.microsoft.com/appx/2013/xbox/manifest" IgnorableNamespaces="mx">
      ...
          <Applications>
              <Application Id="MyApp" Executable="MyApp.exe" EntryPoint="MyApp.App">
      ...
                  <Extensions>
                      <mx:Extension Category="xbox.live">
                          <mx:XboxLive TitleId="12345678" PrimaryServiceConfigId="12345678-9abc-def0-1234-56789abcdef0"/>
                      </Extension>
                      <mx:Extension Category="windows.xbox.networking">
                          <mx:XboxNetworkingManifest>
                              <mx:SocketDescriptions>
                                  <mx:SocketDescription Name="ConsoleInitSocket" SecureIpProtocol="Udp" BoundPort="0">
                                      <mx:AllowedUsages>
                                          <mx:SecureDeviceSocketUsage Type="Initiate" />
                                          <mx:SecureDeviceSocketUsage Type="SendGameData" />
                                          <mx:SecureDeviceSocketUsage Type="ReceiveGameData" />
                                      </mx:AllowedUsages>
                                  </mx:SocketDescription>
                                  <mx:SocketDescription Name="ConsoleAcceptSocket" SecureIpProtocol="Udp" BoundPort="43210">
                                      <mx:AllowedUsages>
                                          <mx:SecureDeviceSocketUsage Type="Accept" />
                                          <mx:SecureDeviceSocketUsage Type="SendChat" />
                                          <mx:SecureDeviceSocketUsage Type="ReceiveChat" />
                                       </mx:AllowedUsages>
                                  </mx:SocketDescription>
                              </mx:SocketDescriptions>
                              <mx:SecureDeviceAssociationTemplates>
                                <mx:SecureDeviceAssociationTemplate 
                                    Name="PeerTraffic" 
                                    InitiatorSocketDescription="ConsoleInitSocket" 
                                    AcceptorSocketDescription="ConsoleAcceptSocket" 
                                    MultiplayerSessionRequirement="None">
                                  <mx:AllowedUsages>
                                    <mx:SecureDeviceAssociationUsage Type="InitiateFromMicrosoftConsole" />
                                    <mx:SecureDeviceAssociationUsage Type="AcceptOnMicrosoftConsole" />
                                  </mx:AllowedUsages>
                                </mx:SecureDeviceAssociationTemplate>
                              </mx:SecureDeviceAssociationTemplates>
                          </mx:XboxNetworkingManifest>
                      </mx:Extension>
                  </Extensions>
              </Application>
    ...
          </Applications>
          <Capabilities>
              <Capability Name="internetClientServer">
          </Capabilities>
      </Package>  

Networking elements in an app manifest

The XML elements in an app manifest that are pertinent to configuring your app to use secure sockets are briefly described here. For complete descriptions of these elements, and the other elements that are part of an app manifest, see Application Manifest Schema.

mx:XboxNetworkingManifest
  Root node that must be present. It must be a child of mx:Extension with the Category attribute set to windows.xbox.networking, as shown in the preceding example.

mx:SocketDescriptions
  Optional container element for a collection of 0 or more mx:SocketDescription nodes.

mx:SocketDescription
  An element describing a SecureDeviceSocketDescription object to instantiate. If this optional element exists, it must have an AllowedUsages child element. For descriptions of the required attributes, see <mx:SocketDescription> Element.

mx:AllowedUsages
  Every mx:SocketDescription element must have one mx:AllowedUsages container element for a collection of one or more SecureDeviceSocketUsage elements. This element is a child of SocketDescription.

mx:SecureDeviceSocketUsage
  Every mx:AllowedUsages element must have one or more mx:SecureDeviceSocketUsage elements. An element describing a SecureDeviceSocketUsage flag to enable.

mx:SecureDeviceAssociationTemplates
  Optional container element for the collection of 0 or more mx:SecureDeviceAssociationTemplate nodes.

mx:SecureDeviceAssociationTemplate

An optional element describing a SecureDeviceAssociationTemplate object to instantiate. Every mx:SecureDeviceAssociationTemplate that exists must have an mx:AllowedUsages child element. For a complete description of the required attributes, see <mx:SecureDeviceAssociationTemplate> Element.

mx:AllowedUsages

Required container element for the collection of one or more mx:SecureDeviceAssociationUsage nodes. This element is a child of SecureDeviceAssociationTemplate.

mx:SecureDeviceAssociationUsage
  An element describing a SecureDeviceAssociationUsage flag to enable. For a complete description of the required attributes, see <mx:SecureDeviceAssociationUsage> Element.