Sdílet prostřednictvím


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

Syntax

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

Parameters

  • sessionType
    Type: NetworkSessionType
    Type of session sought.
  • localGamers
    Type: IEnumerable<SignedInGamer>
    A collection of local gamers to add to the network session.
  • searchProperties
    Type: NetworkSessionProperties
    Optional session properties to match during the search. If this argument is null, the query results will not be filtered based on properties of available sessions. If any of the search property values in searchProperties are specified, the query returns only sessions with matching properties. null items in the searchProperties collection will match to any value for that session property.
  • callback
    Type: AsyncCallback
    Method to be called once the asynchronous operation is finished.
  • asyncState
    Type: Object
    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.

Remarks

The collection of gamers provided in localGamers are not added to a session until NetworkSession.Join is called with one of the sessions returned from the search. The gamers are provided here for matchmaking purposes.

See Also

Overview

Working with Asynchronous Methods in XNA Game Studio

Reference

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

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP