Share via


NetworkSession.JoinInvited Method (Int32)

Joins the local machine to an existing network session in response to an InviteAccepted notification event from a non-local session.

Note

Use the NetworkSession.AddLocalGamer method to join players to a session in response to an InviteAccepted notification event for a session that already exists locally, as indicated by IsCurrentSession.

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

Syntax

public static NetworkSession JoinInvited (
         int maxLocalGamers
)

Parameters

  • maxLocalGamers
    Type: Int32
    The number of local signed-in gamers to add to the network session when accepting the invite. This must be at least one, and can be as high as the limit imposed by either the title or platform. On Windows, this value must always be set to one.

Return Value

The network session.

Exceptions

Exception type Condition
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

If there are fewer signed-in gamers than the number specified in maxLocalGamers, all currently-available signed-in gamers will be added. This method does not allow specifying particular signed-in gamers in the event that there are more local signed-in gamers than the number to add.

This method blocks until the operation has completed. For an asynchronous version of this method, see BeginJoinInvited.

See Also

Reference

Guide.ShowGameInvite Method
NetworkSession.InviteAccepted Event
NetworkSession.BeginJoinInvited Method
NetworkSession.EndJoinInvited Method
NetworkSession Class
NetworkSession Members
Microsoft.Xna.Framework.Net Namespace

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP