Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

network.h

Go to the documentation of this file.
00001 /*
00002         $Id: network.h,v 1.4 2001/03/23 15:09:36 mbn Exp $
00003 
00004         ------------------------------------------------------------------------
00005         ClanLib, the platform independent game SDK.
00006 
00007         This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00008         version 2. See COPYING for details.
00009 
00010         For a total list of contributers see CREDITS.
00011 
00012         ------------------------------------------------------------------------
00013 
00014         File purpose:
00015                 Network component header file.
00016 
00017 
00018 */
00019 
00021 
00022 #ifndef header_network
00023 #define header_network
00024 
00025 #include <string>
00026 class CL_NetSession;
00027 
00028 class CL_Network
00029 //: Network component class. Starting place for all net activity in ClanLib.
00030 {
00031 public:
00032         static void find_sessions_broadcast(
00033                 std::string game_id,
00034                 int port);
00035         //: Searchs for games using UDP broadcasting at the specified 'port'. 
00036         //: Only games with the same 'game_id' are added to CL_Network::netsessions.
00039         
00040         static void find_session_at(
00041                 std::string app_id,
00042                 const char *host_address,
00043                 int port);
00044         //: Searchs for games at the specified host address and port ('port').
00047         
00048         static bool peek_session_found();
00049         //: Returns true if any netsessions have been found. Use receive_game_found() to
00050         //: get the individual games found.
00052 
00053         static CL_NetSession *receive_session_found(int timeout_millis);
00054         //: Returns the first netsession found. It is then removed from the list of games
00055         //: found. Next time it is called it will return the next in available. <br>
00056         //: The function is blocking until the specified timeout runs out.
00057         //: If set to zero, it will block forever until a game has been found.<br>
00058         //: Remember to delete the netsession returned after usage.
00062 
00063         static void clear_sessions_found();
00064         //: Clears the list of sessions found.
00065 
00066         static CL_NetSession *create_session(
00067                 std::string app_id,
00068                 int port);
00069         //: Creates a new network game.
00073 };
00074 
00075 #endif

Generated at Wed Apr 4 19:54:02 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001