CHAPTER 8 ■ NETWORKING IN XNA 3.0
608
{
networkSession =
➥
NetworkSession.Create(NetworkSessionType.SystemLink, ➥
4, 8);
networkSession.AllowHostMigration = true;
networkSession.AllowJoinInProgress = false;
log.Add("New session created");
HookSessionEvents();
currentGameState = GameState.InSession;
}
break;
case GameState.InSession:
{
networkSession.Update();
}
break;
}
}
base.Update(gameTime);
}
8-3. Join a Network Session
The Problem
You wanttosearchyourmachine,thenetwork,ortheLiveserversforactive sessions of your
game. You want to select one session from the list of detected sessions and join it.
The Solution
You can search for active sessions using the NetworkSessions.Find method. This will return an
AvailableNetworkSessionCollection ...