Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

ZE::ZClient Class Reference

#include <ZE_ZClient.h>

List of all members.


Detailed Description

ZClient net client class, used to create a simple TCP game client for use with ZServer.
Since:
0.8.3


Public Methods

 ZClient (bool verbose=false)
 Default Constructor.

virtual ~ZClient ()
 Destructor, disconnects and frees memory.

bool Connect (char *server, Uint16 port)
 Connects to a server on a given port.

void Disconnect ()
 Disconnect client.

void SetWaitTime (int wait)
 Sets wait time for recieves.

bool Send (ZByte *data, int size)
 Send data too connected server.

int Receive (ZByte *data)
 Recieve data if available.

bool Connected ()
 Return connected state.

int WaitTime ()
 Gets current wait time.


Protected Attributes

ZEnginerEngine
 Pointer to ZEngine Object.

TCPsocket rSocket
 SDL_net socket for connection.

SDLNet_SocketSet rSocketSet
 Socket set for connection.

bool rVerbose
 Verbose setting for connection logs.

int rWaitTime
 Wait timeout setting for recieves on connection. [Defaults to 0.].


Constructor & Destructor Documentation

ZE::ZClient::ZClient bool    verbose = false
 

Default Constructor, does basic initialization. If verbose is true connection data will be added to log file.

Parameters:
verbose Sets verbose setting of client. [Defaults to false.]

virtual ZE::ZClient::~ZClient   [virtual]
 

Destructor calls ZClient::Disconnect().


Member Function Documentation

bool ZE::ZClient::Connect char *    server,
Uint16    port
 

Connects to a server (given in dotted ip form) on a given port.

Parameters:
server Dotted IP address to connect to.
port Port number to connect to.
Returns:
true if connected, false otherwise.

void ZE::ZClient::Disconnect  
 

Disconnect from server if connected.

void ZE::ZClient::SetWaitTime int    wait
 

Sets wait time in milliseconds , time which ZClient::Recieve will wait before returning if there is no data. Before this is called for the first time WaitTime is 0.

Parameters:
wait Wait time.

bool ZE::ZClient::Send ZByte   data,
int    size
 

Sends data to server if available.

Parameters:
data Pointer to data buffer to send.
size Size of data buffer. (Can't be larger than MAX_MSG_LEN as defined in ZE_Defines.h)
Returns:
True if data could be sent, false upon error.

int ZE::ZClient::Receive ZByte   data
 

Recieves data from server if available, waiting for timeout period if no data is pending.

Parameters:
data Pointer to buffer to store data in. (Must be large enough, needs not be more than MAX_MSG_LEN as defined in ZE_Defines.h)
Returns:
Size of recieved data stored to buffer. (<MAX_MSG_LEN)

bool ZE::ZClient::Connected  
 

Returns state of connection.

Returns:
true if connected, false otherwise

int ZE::ZClient::WaitTime  
 

Gets amount of time in milliseconds that is specified to wait for data on Recieve.

Returns:
Wait time.


The documentation for this class was generated from the following file:
Generated on Sun Apr 27 22:34:35 2003 for ZEngine by doxygen1.3-rc2