Hosting the Session

When you're trying to get started in a peer-to-peer session, a “first” connection must accept the incoming network data from the other peers. In normal terms, this player is considered the host, even though each peer in the session is in reality its own host, considering that it holds its own data and so on. The player who is the host of this session must call a special method, Host (fancy that), to get the session started, so add the code from Listing 16.4 to your class now.

Listing 16.4. Hosting a Session
 /// <summary> /// Will host a session on your computer /// </summary> public void Host() { // Update with your information PlayerInformation info = new PlayerInformation(); info.Name = Environment.UserName; networkDevice.SetPeerInformation(info, ...

Get Beginning 3D Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.