00001 /******************************************************************************* 00002 This file is Part of the ZEngine Library for 2D game development. 00003 Copyright (C) 2002, 2003 James Turk 00004 00005 Licensed under a BSD-style license. 00006 00007 The maintainer of this library is James Turk (james@conceptofzero.net) 00008 and the home of this Library is http://www.zengine.sourceforge.net 00009 *******************************************************************************/ 00010 00024 #ifndef __ze_zserver_h__ 00025 #define __ze_zserver_h__ 00026 00027 #include "ZE_ZEngine.h" 00028 00029 #ifdef USE_SDL_NET 00030 00031 namespace ZE 00032 { 00033 00041 class ZServer 00042 { 00043 private: 00045 ZEngine *rEngine; 00047 TCPsocket rSocket; 00049 SDLNet_SocketSet rSocketSet; 00051 TCPsocket *rClientSockets; 00053 int rMaxClients; 00055 bool rVerbose; 00057 int rWaitTime; 00058 00065 void CloseSocket(int num); 00066 00067 public: 00074 ZServer(bool verbose=false); 00075 00081 virtual ~ZServer(); 00082 00091 bool Start(int maxClients, Uint16 port); 00092 00098 void Stop(); 00099 00107 void SetWaitTime(int wait); 00108 00115 void CheckSockets(); 00116 00123 int Clients(); 00124 00131 int WaitTime(); 00132 }; 00133 00134 } //namespace ZE 00135 00136 #endif //USE_SDL_NET 00137 00138 #endif //__ze_zserver_h__