NetworkSession.Create Method (NetworkSessionType, Int32, Int32)
Starts hosting a new multiplayer session. This method blocks until the operation has completed.
Namespace: Microsoft.Xna.Framework.Net
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
Syntax
public static NetworkSession Create (
NetworkSessionType sessionType,
int maxLocalGamers,
int maxGamers
)
Parameters
- sessionType
Type of session being hosted. - maxLocalGamers
Maximum number of local players on the same gaming machine in this network session. - maxGamers
Maximum number of players allowed in this network session. For Windows- or Xbox 360-based games, this value must be between 2 and 31; 31 is the maximum number of players supported in a session. For Zune-based games, this value must be between 2 and 8; 8 is the maximum number of players supported in the session.
Return Value
The newly hosted session.
Exceptions
Exception type | Condition |
---|---|
ArgumentOutOfRangeException | One of the following conditions is true:
|
InvalidOperationException | One of the following conditions is true:
|
ObjectDisposedException | This NetworkSession is disposed. |
Remarks
Zune Specific Information |
---|
For Zune-based games, maxGamers must be between 2 and 8; 8 is the maximum number of players supported in the session. |
Windows Specific Information |
---|
For Windows-based games, maxGamers must be between 2 and 31; 31 is the maximum number of players supported in a session. |
Xbox 360 Specific Information |
---|
For Xbox 360-based games, maxGamers must be between 2 and 31; 31 is the maximum number of players supported in a session. |
Behavior of Local Sessions
XNA Game Studio 3.0 introduces a change in the behavior of network sessions when local profiles sign out in the middle of a session. In previous versions of XNA Game Studio, a session would end whenever a player signed out. Now, profiles that sign out are removed from the session, and the session will be ended only if there are no suitable players left in the session.
See Also
Reference
NetworkSession Class
NetworkSession Members
Microsoft.Xna.Framework.Net Namespace
Platforms
Xbox 360, Windows XP SP2, Windows Vista, Zune