#include <ZE_ZServer.h>
Public Methods | |
ZServer (bool verbose=false) | |
Default Constructor. | |
virtual | ~ZServer () |
Destructor, disconnects server and frees memory. | |
bool | Start (int maxClients, Uint16 port) |
Starts server. | |
void | Stop () |
Stops server. | |
void | SetWaitTime (int wait) |
Sets wait time for recieves. | |
void | CheckSockets () |
Check sockets for connections or data. | |
int | Clients () |
Gets number of clients. | |
int | WaitTime () |
Gets current wait time. | |
Private Methods | |
void | CloseSocket (int num) |
Closes a socket. | |
Private Attributes | |
ZEngine * | rEngine |
Pointer to ZEngine Object. | |
TCPsocket | rSocket |
SDL_net socket for connection. | |
SDLNet_SocketSet | rSocketSet |
Socket set for client connections. | |
TCPsocket * | rClientSockets |
SDL_net TCPSockets for client connections. | |
int | rMaxClients |
Maximum number of clients. | |
bool | rVerbose |
Verbose setting for connection logs. | |
int | rWaitTime |
Wait timeout setting for recieves on connection. [Defaults to 0.]. |
|
Default Constructor, does basic initialization. If verbose is true connection data will be added to log file.
|
|
Destructor calls ZServer::Stop(). |
|
Close a socket given by it's number.
|
|
Starts server with a number of maximum clients and on a specified port.
|
|
Closes port and disconnects all clients. |
|
Sets wait time in milliseconds , time which ZServer::CheckSockets will wait before returning if there is no activity. Before this is called for the first time the wait time is 0.
|
|
Check sockets for connections or data, accepting new connections or relaying data from existing connections. Waits the specified wait period. This should be called very often to keep events flowing. |
|
Finds number of connected clients.
|
|
Gets amount of time in milliseconds that is specified to wait for data on CheckSockets.
|