Sdílet prostřednictvím


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 (in microsoft.xna.framework.dll)

Syntax

public static NetworkSession Join (
         AvailableNetworkSession availableSession
)

Parameters

  • availableSession
    An existing multiplayer session.

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 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

Tasks

How To: Find and Join a Network Session

Reference

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

Platforms

Xbox 360, Windows XP SP2, Windows Vista, Zune