#include <connection.h>
Definition at line 36 of file connection.h.
Public Types | |
enum | State { OK, NET_ERROR } |
Public Member Functions | |
~Connection () | |
bool | connect (const std::string &address, short port) |
Connects to the given server with the specified address and port. | |
void | disconnect () |
Disconnects from the given server. | |
State | getState () |
bool | isConnected () |
Returns whether the server is connected. | |
void | send (const MessageOut &msg) |
Sends a message. | |
Private Member Functions | |
Connection (ENetHost *client) | |
Private Attributes | |
ENetPeer * | mConnection |
ENetHost * | mClient |
State | mState |
Friends | |
Connection * | getConnection () |
Returns a new Connection object. |
Net::Connection::~Connection | ( | ) |
Definition at line 38 of file connection.cpp.
Net::Connection::Connection | ( | ENetHost * | client | ) | [private] |
Definition at line 32 of file connection.cpp.
bool Net::Connection::connect | ( | const std::string & | address, | |
short | port | |||
) |
Connects to the given server with the specified address and port.
This method is non-blocking, use isConnected to check whether the server is connected.
Definition at line 43 of file connection.cpp.
void Net::Connection::disconnect | ( | ) |
State Net::Connection::getState | ( | ) | [inline] |
Definition at line 58 of file connection.h.
bool Net::Connection::isConnected | ( | ) |
void Net::Connection::send | ( | const MessageOut & | msg | ) |
Connection* getConnection | ( | ) | [friend] |
Returns a new Connection object.
Should be deleted by the caller.
Definition at line 76 of file network.cpp.
ENetPeer* Net::Connection::mConnection [private] |
Definition at line 74 of file connection.h.
ENetHost* Net::Connection::mClient [private] |
Definition at line 75 of file connection.h.
State Net::Connection::mState [private] |
Definition at line 76 of file connection.h.