NetworkSession.SimulatedLatency Property

Gets or sets the amount of simulated network latency.

Namespace: Microsoft.Xna.Framework.Net
Assembly: Microsoft.Xna.Framework.Net (in microsoft.xna.framework.net.dll)

Syntax

public TimeSpan SimulatedLatency { get; set; }

Property Value

The amount of simulated network latency, in milliseconds. The default value is 0.

Remarks

SimulatedLatency is useful if you are testing a system link game on a fast local network and want to make sure it will also work correctly over the Internet. Xbox games are typically expected to work with up to 200 milliseconds of latency.

The latency simulation is applied on the sending machine, so if you set this property differently on each machine, only outgoing packets will be affected by the local value of the property. Latency introduced through this setting is not included in the RoundtripTime property, which always just reports the physical network latency.

Packets sent without any ordering guarantee will be given a random latency normally distributed around the specified value, introducing packet reordering as well as raw latency. Packets sent using SendDataOptions.InOrder will be delayed without reordering.

Warning

The packet loss and latency simulation in the XNA Framework applies to messages that are sent to all players, including local players. In game designs where data to local players is sent and received using the network session SendData methods, local players will experience the set values for simulated packet loss and latency. To work around this issue, avoid broadcasting messages to all users and set SimulatedPacketLoss and SimulatedLatency on a per-send basis.

See Also

Reference

NetworkSession Class
NetworkSession Members
Microsoft.Xna.Framework.Net Namespace

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP