Indiefreaks.Xna.Sessions.Lidgren.LidgrenSession.BeginFindWan C# (CSharp) 메소드

BeginFindWan() 정적인 개인적인 메소드

static private BeginFindWan ( SessionType sessionType, int maxLocalPlayers, SessionProperties sessionProperties, string host, int port, AsyncCallback callback, object asyncState ) : IAsyncResult
sessionType SessionType
maxLocalPlayers int
sessionProperties SessionProperties
host string
port int
callback AsyncCallback
asyncState object
리턴 IAsyncResult
        internal static IAsyncResult BeginFindWan(SessionType sessionType, int maxLocalPlayers, SessionProperties sessionProperties, string host, int port, AsyncCallback callback, object asyncState)
        {
            
            if (sessionType == SessionType.SinglePlayer || sessionType == SessionType.SplitScreen)
            {
                throw new CoreException("Cannot look for SinglePlayer or SplitScreen sessions");
            }

            _localDiscoveryRequested = true;

            var asyncFind = new AsynchronousFind(Find);
            return asyncFind.BeginInvoke(sessionType, maxLocalPlayers, sessionProperties, host, port, callback, asyncState);
        }

Usage Example

예제 #1
0
        /// <summary>
        /// Sends a Find query on the network interface to look for AvailableSession instances asynchrnously
        /// </summary>
        /// <param name="sessionType">The SessionType we're looking for</param>
        /// <param name="maxLocalPlayers">The Maximum local players that can be added to the session used to filter sessions that have a limited number of opened public slots</param>
        /// <param name="sessionProperties">The SessionProperties that will be used to filter query results. Can be null</param>
        /// <param name="host">The for WAN session discovery</param>
        /// <param name="port">The for WAN session discovery</param>
        public void FindSessionsWan(SessionType sessionType, int maxLocalPlayers, SessionProperties sessionProperties, string host = null, int port = ServerPort)
        {
            if (CurrentSession != null)
            {
                throw new CoreException("Session is already running");
            }

            _networkSessionLocker = FindingSessions;
            LidgrenSession.BeginFindWan(sessionType, maxLocalPlayers, sessionProperties, host, port, OnLidgrenSessionsFound, _networkSessionLocker);
        }