Share via


NetworkSession.BeginFind Method (NetworkSessionType, Generic IEnumerable, NetworkSessionProperties, AsyncCallback, Object)

Starts a matchmaking query to search for available multiplayer sessions, specifying a collection of local gamers to add to the network session. Call EndFind to access the results of this asynchronous call.

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

Syntax

public static IAsyncResult BeginFind (
         NetworkSessionType sessionType,
         IEnumerable<SignedInGamer> localGamers,
         NetworkSessionProperties searchProperties,
         AsyncCallback callback,
         Object asyncState
)

Parameters

  • sessionType
    Type of session sought.
  • localGamers
    Collection of local gamers to participate in the network session. The first gamer in the collection becomes the host, and the others are added to the session.
  • searchProperties
    Optional session properties to match during the search. If this argument is null, the query results will not be filtered based on the session properties of available sessions. If any of the search property values in searchProperties are specified, only sessions with matching properties will be returned by the query. null items in the searchProperties collection will match to any value for that session property.
  • callback
    Method to be called once the asynchronous operation has finished.
  • asyncState
    State of the asynchronous operation.

Return Value

An IAsyncResult used to track the progress of the method.

Exceptions

Exception type Condition
ArgumentException BeginFind cannot be used from NetworkSession objects of session type NetworkSessionType.Local.
ArgumentOutOfRangeException maxLocalGamers must be between 1 and 4.

See Also

Reference

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

Platforms

Xbox 360, Windows XP SP2, Windows Vista, Zune