Starts a network simulation given a collection of channels.
public:
static IAsyncAction^ StartSimulationNetworkChannelsAsync(
IVectorView<SimulationNetworkChannelProfile>^ networkChannelProfiles
)
networkChannelProfiles
Type: IVectorView<SimulationNetworkChannelProfile>
A collection of SimulationNetworkChannelProfile objects defining the behavior of the simulated network.
Type: IAsyncAction
Returns an IAsyncAction object that represents the state of the asynchronous operation.
StartSimulationNetworkChannelsAsync allows network simulation where different parts of the network have different performance characteristics. Groups of addresses with the same performance characteristics are specified using SimulationNetworkChannelProfile objects passed to StartSimulationNetworkChannelsAsync. This allows for more complicated network simulations than simply making a call to StartAsync like SimulationManager.StartAsync(SimulationType.network,SimulationProfile.networkMinimum) which would apply the same SimulationProfile to all network traffic.
StartSimulationNetworkChannelsAsync is the equivalent of using the xbstress command line tool to start a channel based network simulation by calling xbstress set to define a network and then calling xbstress simulate network=channels. For example:
xbstress set channel=0 network=broken addresses=achievements.xboxlive.com
xbstress set channel=1 network=min
xbstress simulate network=channels
xbstress stop
Only one simulation may be running at any given time. If StartSimulationNetworkChannelsAsync is called when a simulation is running, the error code 0x8000000d “An illegal state change was requested.” will be returned. Note that the limitation that only one simulation may be running applies both to this API and to the network simulations started with the xbStress command line tool (i.e xbStress simulate network=avg or xbstress simulate=channels). That is, if a simulation is started using xbStress, calls to SimulationManager::StartSimulationNetworkChannelsAsync will fail with “An illegal state change was requested.”
See Network stress for more information on network simulation.
var XtfSimulationManager = Microsoft.Xbox.Tools.ConsoleExtensions.SimulationManager;
var networkAddresses = ["1.2.3.4", "www.example.com"]; // these could also be hostnames
var networkChannelProfile = new Microsoft.Xbox.Tools.ConsoleExtensions.SimulationNetworkChannelProfile(
0,
Microsoft.Xbox.Tools.ConsoleExtensions.SimulationProfile.networkAverage,
networkAddresses
);
var networkChannelProfiles = [];
networkChannelProfiles.push(networkChannelProfile);
// add more channel profiles if desired
XtfSimulationManager.startSimulationNetworkChannelsAsync(networkChannelProfiles).then(
function complete() {
// Handle success here
writeLog("SimulationManager.startSimulationNetworkChannelsAsync succeeded");
}.bind(this),
function error(e) {
// Handle error here
writeError("SimulationManager.startSimulationNetworkChannelsAsync error: ", e);
}.bind(this)
);
Namespace: Microsoft.Xbox.Tools.ConsoleExtensions
Metadata: microsoft.xbox.tools.consoleextensions.winmd