Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields

broadcast.h

00001 #ifdef HAVE_SDL_NET
00002 #ifndef BROADCAST_H
00003 #define BROADCAST_H
00004 
00005 #include "../constants.h"
00006 
00007 using namespace std;
00008 
00009 // since broadcasting doesn't appear to work in SDL_net, this is disabled
00010 #define ENABLE_BROADCASTING 0
00011 
00012 class Broadcast {
00013  private:
00014 
00015   // UDP broadcast
00016   static const Uint16 udpPortServer = 9999;
00017   static const Uint16 udpPortClient = 9998;
00018   IPaddress broadcastIP;
00019   UDPsocket udpSocket;
00020   UDPpacket *udpPacket;
00021   Uint32 lastBroadcastTime;
00022   static const Uint32 BROADCAST_DELAY = 1000;
00023   static const Uint32 FIND_SERVER_DELAY = 200;
00024   int serverPort;
00025 
00026  public:
00027   Broadcast(int serverPort=-1);  
00028   ~Broadcast();
00029   void broadcast();
00030   bool listen(IPaddress *ip, Uint32 timeout);
00031 
00032  protected:
00033   void initBroadcastSocket();
00034 };
00035 
00036 #endif
00037 #endif

Generated on Thu Jun 16 21:50:42 2005 for scourge by  doxygen 1.4.0