Sending Data Packets
You've already written some code for sending a simple data packet in the peer-to-peer session, but all you really did was send a single byte of data, and it didn't even really matter what that data was. In a real networking session, the traffic that will be sent between the server and the clients will be much more varied, and intended to perform specific actions.
To model more accurately what a “real” application might do, you should add a few options to the client that facilitate sending various data packets to the server. You can include the following actions for your client:
Check the number of players currently in the session.
Wave to other players in the session.
Send “private” data to the server.
Run away from the other ...
Get Managed DirectX® 9 Kick Start: Graphics and 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.