Contents User Forum Source Index APIs by Task APIs by Level Data


Discovery.h File Reference

#include "G3D/platform.h"
#include "G3D/G3DGameUnits.h"
#include "G3D/NetworkDevice.h"
#include "G3D/Log.h"
#include <time.h>

Namespaces

namespace  G3D

Classes

class  G3D::Discovery
 Base class for DiscoveryClient and DiscoveryServer. More...
class  G3D::DiscoveryAdvertisement
 Make your own subclass of this advertisement. More...
class  G3D::DiscoveryClient< AdType >
 Only one DiscoveryClient can be active on a given port at a time on a single computer. More...
class  G3D::DiscoveryClient< AdType >::BroadcastMessage
class  G3D::DiscoveryServer
class  G3D::DiscoveryServer::ShutdownMessage
class  G3D::DiscoveryServerAddressMessage
 Sent by servers to describe their location. More...
class  G3D::DiscoverySettings
 If a machine is running two different programs using discovery they must have different ports. More...
class  G3D::IncompatibleServerDescription
 Used by DiscoveryClient to report servers running a different version of this application's protocol. More...

Defines

#define G3D_DISCOVERY_PROTOCOL_NAME   "G3D DISC"
#define G3D_DISCOVERY_PROTOCOL_VERSION   1

Detailed Description

Discovery

Discovery is the process by which computers on a Local Area Network (LAN) find one another. The Discovery API allows clients to make a list of servers running the same application. The application typically presents this list to the user so he can choose which server to connect to.

Features of the Discovery API:

Low network traffic
- Broadcasts mainly occur only when a new machine enters/leaves the network
Responsive
- Servers appear immediately after launching
- Servers disappear immedatiately after they shut down
Extensible
- Add your own game information (e.g. score, num players, map name)
Versioned
- Tracks incompatible servers so end-users know to upgrade their client/server

Using the Discovery API

Subclass DiscoveryAdvertisement to add fields describing a server running your application. For a game, these might be the current map name and the number of players.

On the client, create an instance of DiscoveryClient<your advertisement subclass>. On the server, create an instance of DiscoveryServer and initialize it with an instance of your advertisement subclass. From your main loop, call doNetwork() on the client and server instances. When your server shuts down, invoke cleanup() on it.

Maintainer:
Morgan McGuire, matrix@graphics3d.com
Created:
2003-06-26
Last modified:
2005-02-24

Define Documentation

#define G3D_DISCOVERY_PROTOCOL_NAME   "G3D DISC"

Different versions of G3D discovery protocols can't communicate with each other.

#define G3D_DISCOVERY_PROTOCOL_VERSION   1


Generated on Thu Aug 2 11:40:42 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo