Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
|
#include <Network.h>
Public Member Functions | |
Network (int maxConnections) | |
~Network () | |
bool | Host (int port, int numPending) |
NetResult | Connect (const char *ipAddr, int port) |
void | Disconnect () |
void | DisconnectClient (int index) |
NetResult | Send (Packet &packet) |
NetResult | Send (Packet &packet, int sendTo) |
void | Process () |
void | SetCallbackFunction (NetCallback funcPtr) |
bool | IsConnected () const |
int | GetMaxConnections () const |
int | GetTotalConnections () const |
NetType | GetNetworkType () const |
Wrapper for a network connection, either as a server or client.
Ult::Network::Network | ( | int | maxConnections | ) |
Network constructor.
maxConnections | The number of maximum connected clients, if this will be a server. |
Ult::Network::~Network | ( | ) |
Network destructor.
NetResult Ult::Network::Connect | ( | const char * | ipAddr, |
int | port ) |
Attempt to initialize as a client, connecting to the server at the given ip address and port number.
void Ult::Network::Disconnect | ( | ) |
If a client, disconnect from the server. If a server, close the server. Sends a disconnect message packet to any connections.
void Ult::Network::DisconnectClient | ( | int | index | ) |
If a server, send a disconnect message packet to the client and close the connection to the client at the given index.
|
inline |
For servers, returns the maximum allowed number of connections.
|
inline |
Returns whether this is a server, client, or uninitialized.
|
inline |
For servers, returns the total number of current connections.
bool Ult::Network::Host | ( | int | port, |
int | numPending ) |
Initialize as a server, listening on the given port.
numPending | The maximum queue length of pending connections. |
|
inline |
Returns whether the network connection is active or not.
void Ult::Network::Process | ( | ) |
Attempts to process any connections and any received data.
If a server, send a message packet to a specific client connection.
|
inline |
Sets the function to be called on accepted connection, received data, network errors.