Planeshift
Public Types | Public Member Functions | Protected Attributes

psServerPinger Class Reference

Class psServerPinger takes care about sending pings to a server in Login screen. More...

#include <serverpinger.h>

List of all members.

Public Types

enum  SERVERSTATUS {
  INIT, FAILED, READY, WAIT,
  FULL, LOCKED
}

Public Member Functions

bool Connect ()
 Opens connection to server.
void Disconnect ()
 Sends server disconnection message.
void DoYourWork ()
 Call this periodically.
csString GetAddress ()
csString GetDescription ()
int GetFlags ()
 Returns last received flags from server.
float GetLoss ()
csString GetName ()
int GetPing ()
 Returns currently measured ping to server is miliseconds.
int GetPort ()
SERVERSTATUS GetStatus ()
bool Initialize ()
 Initialize the connection.
 psServerPinger (const csString &serverName, const csString &description, const csString &address, int port, iObjectRegistry *objReg)
 ~psServerPinger ()

Protected Attributes

csString address
psNetConnectionconnection
csString description
unsigned int flags
 Last flags returned from server. Should only be used if ping != -1 && ping != 9999.
int lastPingTime
 the time when we sent our last ping to server
unsigned int lost
 the number of ping messages lost
csString name
 server info
iObjectRegistry * objReg
int ping
 last measured ping (-1 means timeout, 9999 means wait)
unsigned int pingID
 unique identifier of ping message - enables us to ignore ping responses that come after timeout
int port
MsgQueuequeue
unsigned int sent
 the number of ping messages sent
bool waiting
 are we waiting for ping response from server ?

Detailed Description

Class psServerPinger takes care about sending pings to a server in Login screen.

Definition at line 30 of file serverpinger.h.


Member Enumeration Documentation

Enumerator:
INIT 
FAILED 
READY 
WAIT 
FULL 
LOCKED 

Definition at line 34 of file serverpinger.h.


Constructor & Destructor Documentation

psServerPinger::psServerPinger ( const csString &  serverName,
const csString &  description,
const csString &  address,
int  port,
iObjectRegistry *  objReg 
)
psServerPinger::~psServerPinger ( )

Member Function Documentation

bool psServerPinger::Connect ( )

Opens connection to server.

Returns:
success of the connection
void psServerPinger::Disconnect ( )

Sends server disconnection message.

void psServerPinger::DoYourWork ( )

Call this periodically.

csString psServerPinger::GetAddress ( ) [inline]

Definition at line 77 of file serverpinger.h.

csString psServerPinger::GetDescription ( ) [inline]

Definition at line 76 of file serverpinger.h.

int psServerPinger::GetFlags ( ) [inline]

Returns last received flags from server.

Definition at line 62 of file serverpinger.h.

float psServerPinger::GetLoss ( ) [inline]

Definition at line 66 of file serverpinger.h.

csString psServerPinger::GetName ( ) [inline]

Definition at line 75 of file serverpinger.h.

int psServerPinger::GetPing ( ) [inline]

Returns currently measured ping to server is miliseconds.

Returns -1 if ping timed out

Definition at line 59 of file serverpinger.h.

int psServerPinger::GetPort ( ) [inline]

Definition at line 78 of file serverpinger.h.

SERVERSTATUS psServerPinger::GetStatus ( )
bool psServerPinger::Initialize ( )

Initialize the connection.

Returns:
success of the initialization

Member Data Documentation

csString psServerPinger::address [protected]

Definition at line 83 of file serverpinger.h.

Definition at line 86 of file serverpinger.h.

csString psServerPinger::description [protected]

Definition at line 82 of file serverpinger.h.

Last flags returned from server. Should only be used if ping != -1 && ping != 9999.

Definition at line 95 of file serverpinger.h.

the time when we sent our last ping to server

Definition at line 90 of file serverpinger.h.

the number of ping messages lost

Definition at line 92 of file serverpinger.h.

csString psServerPinger::name [protected]

server info

Definition at line 81 of file serverpinger.h.

iObjectRegistry* psServerPinger::objReg [protected]

Definition at line 96 of file serverpinger.h.

last measured ping (-1 means timeout, 9999 means wait)

Definition at line 89 of file serverpinger.h.

unique identifier of ping message - enables us to ignore ping responses that come after timeout

Definition at line 94 of file serverpinger.h.

Definition at line 84 of file serverpinger.h.

Definition at line 87 of file serverpinger.h.

the number of ping messages sent

Definition at line 91 of file serverpinger.h.

bool psServerPinger::waiting [protected]

are we waiting for ping response from server ?

Definition at line 93 of file serverpinger.h.


The documentation for this class was generated from the following file: