CL_Network3
Network component class. starting place for all net activity in clanlib.
Class members
- static void
find_games_broadcast( -
std::string game_id, int port)
- static void
find_game_at( -
std::string game_id, const char *host_address, int port)
- static bool
peek_game_found()
- static CL_NetGame *
receive_game_found( -
int timeout_millis)
- static void
clear_games_found()
- static CL_NetGame *
create_game( -
std::string game_id, int port)
Members with descriptions
- static void
find_games_broadcast( -
std::string game_id, int port)
Parameters: game_id - The game's ID used to locate this type of game with. port - Broadcast UDP port.
Description:
Searchs for games using UDP broadcasting at the specified port. Only games with the same game_id are added to CL_Network::netgames.
- static void
find_game_at( -
std::string game_id, const char *host_address, int port)
Parameters: host_address - IP address or hostname of the computer to be contacted. port - Port which the computer contacted listens on.
Description:
Searchs for games at the specified host address and port (port).
- static bool
peek_game_found() -
Description:
Returns true if any netgames have been found. Use receive_game_found() toget the individual games found.
Return value:
True if any netgames have been found.
- static CL_NetGame *
receive_game_found( -
int timeout_millis)
Parameters: timeout_millis - Timeout before returning if no game was found.
Description:
Returns the first netgame found. It is then removed from the list of gamesfound. Next time it is called it will return the next in available. The function is blocking until the specified timeout runs out.If set to zero, it will block forever until a game has been found.Remember to delete the netgame returned after usage.
Return value:
The netgame found, or NULL if timed out. Remember to delete the netgame after usage.
- static void
clear_games_found() -
Description:
Clears the list of games found.
- static CL_NetGame *
create_game( -
std::string game_id, int port)
Parameters: game_id - The game ID is used to locate netgames of the same type. port - Port the game accepts connections on - and listens for broadcasts.
Description:
Creates a new network game.
Return value:
The created network game.