Planeshift
|
Class psServerPinger takes care about sending pings to a server in Login screen. More...
#include <serverpinger.h>
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 |
psNetConnection * | connection |
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 |
MsgQueue * | queue |
unsigned int | sent |
the number of ping messages sent | |
bool | waiting |
are we waiting for ping response from server ? |
Class psServerPinger takes care about sending pings to a server in Login screen.
Definition at line 30 of file serverpinger.h.
Definition at line 34 of file serverpinger.h.
psServerPinger::psServerPinger | ( | const csString & | serverName, |
const csString & | description, | ||
const csString & | address, | ||
int | port, | ||
iObjectRegistry * | objReg | ||
) |
psServerPinger::~psServerPinger | ( | ) |
bool psServerPinger::Connect | ( | ) |
Opens connection to server.
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.
csString psServerPinger::address [protected] |
Definition at line 83 of file serverpinger.h.
psNetConnection* psServerPinger::connection [protected] |
Definition at line 86 of file serverpinger.h.
csString psServerPinger::description [protected] |
Definition at line 82 of file serverpinger.h.
unsigned int psServerPinger::flags [protected] |
Last flags returned from server. Should only be used if ping != -1 && ping != 9999.
Definition at line 95 of file serverpinger.h.
int psServerPinger::lastPingTime [protected] |
the time when we sent our last ping to server
Definition at line 90 of file serverpinger.h.
unsigned int psServerPinger::lost [protected] |
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.
int psServerPinger::ping [protected] |
last measured ping (-1 means timeout, 9999 means wait)
Definition at line 89 of file serverpinger.h.
unsigned int psServerPinger::pingID [protected] |
unique identifier of ping message - enables us to ignore ping responses that come after timeout
Definition at line 94 of file serverpinger.h.
int psServerPinger::port [protected] |
Definition at line 84 of file serverpinger.h.
MsgQueue* psServerPinger::queue [protected] |
Definition at line 87 of file serverpinger.h.
unsigned int psServerPinger::sent [protected] |
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.