Share via


NetworkSession.Join Method

Joins an existing multiplayer session. This method blocks until the operation has completed.

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

Syntax

public static NetworkSession Join (
         AvailableNetworkSession availableSession
)

Parameters

Return Value

Session joined by the gamer.

Exceptions

Exception type Condition
ArgumentNullException availableSession is null.
ObjectDisposedException availableSession is disposed.
NetworkSessionJoinException The session either is full, is not joinable, or cannot be found.
  • If the session is full, the specified session does not have enough open slots for all the local gamers signed in to this machine.
  • If it is not joinable, you must wait for the host to return to the lobby before joining.
  • If it cannot be found, the session may have ended, or there may be no network connectivity between the local machine and session host.

Remarks

Use the Find or BeginFind methods to search for available sessions.

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 ended whenever a player signed out. Now the session continues even if one or more profiles sign out. Signed-out players are removed from the session, but the session ends only if no suitable players remain in the session.

See Also

Tasks

Finding and Joining a Network Session

Reference

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

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP