Chapter 4 - NetSprocket
This chapter describes NetSprocket, the component of Apple Game Sprockets that your game can use to provide easy-to-implement, high performance data transmission between players. By implementing NetSprocket in your game, you can enable a player to play a game of chess via modem or join a game with dozens of others on the Internet.Before reading this chapter, you should be generally familiar with Apple Game Sprockets, as described in the preface to the book. You should know the basic principals of networking before reading this chapter.
This chapter begins by describing the basic capabilities of NetSprocket. In the section "Using NetSprocket," you'll learn how to use some of these capabilities. The section "NetSprocket Reference" is where you'll find descriptions of the constants and data structures, along with complete explanations and descriptions of each function included in NetSprocket. The reference section is followed by "Summary of NetSprocket," which contains a comprehensive listing of the constants, data structures, and functions provided by NetSprocket.
- Note
- This chapter describes the application programming interface supported by versions 1.0 and later of NetSprocket.
Chapter Contents
- About NetSprocket
- Players, Groups and Messages
- Players
- Groups
- Messages
- Key Features of NetSprocket
- High Level Network Interface
- Multiple Protocol Support
- Fault-tolerance
- Client/Server Topology
- Network Efficiency and Speed
- Human Interface Elements
- Using NetSprocket
- Initializing NetSprocket
- Hosting a Game
- Creating a Protocol Reference and Advertising Your Game
- Creating a Protocol List
- Adding Protocols to the Protocol List
- Presenting the Host Dialog Box
- Using the Host Function
- Disposing of the Protocol List
- Joining A Game
- Receiving Messages From Other Players
- Sending Messages to Other Players
- Ending The Game
- NetSprocket Reference
- Constants
- Network Message Priority Flags
- Network Message Delivery Flags
- Options for Hosting, Joining, and Deleting Games
- Network Message Types
- Reserved Player IDs for Network Messages
- Topology Types
- Data Structures
- Game Reference
- Protocol Reference
- Protocol List Reference
- Address Reference
- Player Information Structure
- Player Enumeration Structure
- Group Information Structure
- Group Enumeration Structure
- Game Information Structure
- Message Header Structure
- Error Message Structure
- Join Request Message Structure
- Join Approved Message Structure
- Join Denied Message Structure
- Player Joined Message Structure
- Player Left Message Structure
- Host Changed Message Structure
- Game Terminated Message Structure
- NetSprocket Functions
- Initializing NetSprocket
- Human Interface Functions
- Hosting and Joining a Game
- Sending and Receiving Messages
- Managing Network Protocols
- Managing Player Information
- Managing Groups of Players
- Utility Functions
- Summary of NetSprocket
- Constants
- Network Message Priority Flags
- Network Message Delivery Flags
- Options for Hosting, Joining, and Ending Games
- Network Message Types
- Reserved Player IDs for Network Messages
- Topology Types
- Data Types
- Opaque Game Reference Structures
- Player Information Structure
- Player List Structure
- Group Information Structure
- Group Enumeration Structure
- Game Information Structure
- Message Header Structure
- Error Message Structure
- Join Request Message Structure
- Join Approved Message Structure
- Join Denied Message Structure
- Player Joined Message Structure
- Player Left Message Structure
- Host Changed Message Structure
- Game Terminated Message Structure
- NetSprocket Functions
- Initializing NetSprocket
- Human Interface Functions
- Hosting and Joining a Game
- Sending and Receiving Messages
- Managing Network Protocols
- Managing Player Information
- Managing Groups of Players
- Utility Functions
- Result Codes