共用方式為


NetworkSession.Find Method (NetworkSessionType, Int32, NetworkSessionProperties)

Issues a matchmaking query, searching for available multiplayer sessions. 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 AvailableNetworkSessionCollection Find (
         NetworkSessionType sessionType,
         int maxLocalGamers,
         NetworkSessionProperties searchProperties
)

Parameters

  • sessionType
    Type: NetworkSessionType
    Type of session sought.
  • maxLocalGamers
    Type: Int32
    Maximum number of local players on the same gaming machine in this 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 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.

Return Value

Collection of available network multiplayer sessions.

Exceptions

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

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