- Timestamp:
- Nov 10, 2010, 3:35:39 PM (14 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/masterserver/src/libraries/network/MasterServerComm.h
r7629 r7631 27 27 */ 28 28 29 class MasterServerComm 29 #include <cstdlib> 30 #include <cstdio> 31 #include <cstring> 32 #include <enet/enet.h> 33 34 namespace orxonox 30 35 { 31 public: 32 /** constructor */ 33 MasterServerComm(); 36 class MasterServerComm 37 { 38 public: 39 /** constructor */ 40 MasterServerComm(); 34 41 35 /** destructor */36 ~MasterServerComm();42 /** destructor */ 43 ~MasterServerComm(); 37 44 38 39 /** \param address Address to connect to (Host name or IP in text form) 40 * \param port Port to connect on 41 * \return 0 for success, other for error 42 * 43 * Connect to the master server with the given address on the given port. 44 */ 45 int connect( char *address, unsigned int port ); 46 47 /** \param data The data to be sent. 48 * \return 0 for success, other for error. 49 * 50 * Send a request to the master server containing data specified in data 51 */ 52 int sendRequest( char *data ); 53 54 /** \param callback The callback function to call with data receivced. 55 * \return 0 for success, other for error 56 * 57 * Poll the master server for new data and act accordingly */ 58 int pollForReply( int (*callback)( char*, ENetEvent* ) ); 59 60 private: 61 /* client handle */ 62 ENetHost *client; 63 ENetEvent event; 64 65 ENetAddress address; 66 ENetPeer *peer; 45 /** \return 0 for success, other for error 46 * 47 * Initialize everything for the master server communication 48 */ 49 int initialize(); 67 50 68 51 69 }; 52 /** \param address Address to connect to (Host name or IP in text form) 53 * \param port Port to connect on 54 * \return 0 for success, other for error 55 * 56 * Connect to the master server with the given address on the given port. 57 */ 58 int connect( char *address, unsigned int port ); 59 60 /** \param data The data to be sent. 61 * \return 0 for success, other for error. 62 * 63 * Send a request to the master server containing data specified in data 64 */ 65 int sendRequest( char *data ); 66 67 /** \param callback The callback function to call with data receivced. 68 * \return 0 for success, other for error 69 * 70 * Poll the master server for new data and act accordingly */ 71 int pollForReply( int (*callback)( char*, ENetEvent* ) ); 72 73 private: 74 /** client handle */ 75 ENetHost *client; 76 77 /** event data holder */ 78 ENetEvent event; 79 80 /** address holder */ 81 ENetAddress address; 82 83 /** peer data holder */ 84 ENetPeer *peer; 85 }; 86 87 }
Note: See TracChangeset
for help on using the changeset viewer.