3es
0.7
|
Defines the interface for managing a 3es server. More...
#include <3esserver.h>
Public Member Functions | |
virtual void | dispose ()=0 |
Destroys the server this method is called on. This ensures correct clean up. | |
virtual unsigned | flags () const =0 |
Retrieve the ServerFlag set with which the server was created. | |
virtual int | send (const PacketWriter &packet)=0 |
Set a completed packet to all clients. More... | |
virtual int | send (const CollatedPacket &collated)=0 |
Send a collated packet to all clients. More... | |
virtual ConnectionMonitor * | connectionMonitor ()=0 |
Returns the connection monitor object for this Server . More... | |
virtual unsigned | connectionCount () const =0 |
Returns the number of current connections. More... | |
virtual Connection * | connection (unsigned index)=0 |
Requests the connection at the given index. More... | |
virtual const Connection * | connection (unsigned index) const =0 |
![]() | |
virtual | ~Connection () |
Virtual destructor. | |
virtual void | close ()=0 |
Close the socket connection. | |
virtual void | setActive (bool active)=0 |
Activate/deactivate the connection. More... | |
virtual bool | active () const =0 |
Check if currently active. More... | |
virtual const char * | address () const =0 |
Address string for the connection. More... | |
virtual uint16_t | port () const =0 |
Get the connection port. More... | |
virtual bool | isConnected () const =0 |
Is the connection active and valid? More... | |
virtual int | create (const Shape &shape)=0 |
Sends a create message for the given shape. More... | |
virtual int | destroy (const Shape &shape)=0 |
Sends a destroy message for the given shape. More... | |
virtual int | update (const Shape &shape)=0 |
Sends an update message for the given shape. More... | |
virtual int | updateFrame (float dt, bool flush=true)=0 |
Sends a message marking the end of the current frame (and start of a new frame). More... | |
virtual int | updateTransfers (unsigned byteLimit)=0 |
Update any pending resource transfers (e.g., mesh transfer). More... | |
virtual unsigned | referenceResource (const Resource *resource)=0 |
Add a resource to this connection. More... | |
virtual unsigned | releaseResource (const Resource *resource)=0 |
Release a resource within this connection. More... | |
virtual bool | sendServerInfo (const ServerInfoMessage &info)=0 |
Send server details to the client. | |
virtual int | send (const uint8_t *data, int byteCount)=0 |
Send pre-prepared message data to all connections. More... | |
int | send (const int8_t *data, int byteCount) |
Static Public Member Functions | |
static Server * | create (const ServerSettings &settings=ServerSettings(), const ServerInfoMessage *serverInfo=nullptr) |
Creates a server with the given settings. More... | |
Protected Member Functions | |
virtual | ~Server () |
Hidden virtual destructor. | |
Defines the interface for managing a 3es server.
Listening must be initiated via the Server
object's ConnectionMonitor
, available via connectionMonitor()
. See that class's comments for details of synchronous and asynchronous operation. The monitor will be null if connections are not supported (generally internal only).
|
pure virtual |
Requests the connection at the given index.
This data may be stale if the ConnectionMonitor
has yet to update.
index | The index of the requested connection. |
index
is out of range.
|
pure virtual |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
pure virtual |
Returns the number of current connections.
|
pure virtual |
Returns the connection monitor object for this Server
.
Null if connections are not supported (internal only).
|
static |
Creates a server with the given settings.
The settings
affect the local server state, while serverInfo
describes the server to newly connected clients (first message sent). The serverInfo
may be omitted to use the defaults.
settings | The local server settings. |
serverInfo | Server settings published to clients. Null to use the defaults. |
|
pure virtual |
Set a completed packet to all clients.
The packet
must be finalised first.
packet | The packet to send. |
|
pure virtual |
Send a collated packet to all clients.
This supports sending collections of packets as a single send operation while maintaining thread safety.
The collated packet may be larger than the normal send limit as collated message is extracted and sent individually. To support this, compression on collated
is not supported.
collated | Collated packets to send. Compression is not supported. |