NetworkSession.AllowHostMigration Property

Gets or sets whether host migration is allowed. This can be read by any machine in the session, but can only be changed by the host. The default value is false indicating that host migration is disabled.

Namespace: Microsoft.Xna.Framework.Net
Assembly: Microsoft.Xna.Framework.Net (in

public bool AllowHostMigration { get; set; }

Property Value

true to enable host migration; false to disable host migration. The default value is false.

Exception typeCondition
InvalidOperationException This session is not the host, and cannot change the value of AllowHostMigration.
ObjectDisposedExceptionThe session has been disposed.

When host migration is disabled (the default state), the session will be ended if the host leaves the game or there is a network disconnect. If the host enables this setting, after they leave or disconnect a new host will automatically be selected from the machines remaining in the session, and the HostChanged event will be raised to notify you of the change. Note that game simulation state is not automatically transferred during the migration process. It is usually relatively easy for peer-to-peer games to support host migration, but rather more difficult to make this work in a client/server architecture.

Xbox 360, Windows 7, Windows Vista, Windows XP

Community Additions