Net::Connection Class Reference
[Core network layer]

#include <connection.h>

List of all members.


Detailed Description

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

ConnectiongetConnection ()
 Returns a new Connection object.

Member Enumeration Documentation

Enumerator:
OK 
NET_ERROR 

Definition at line 39 of file connection.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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 (  ) 

Disconnects from the given server.

Definition at line 72 of file connection.cpp.

State Net::Connection::getState (  )  [inline]

Definition at line 58 of file connection.h.

bool Net::Connection::isConnected (  ) 

Returns whether the server is connected.

Definition at line 84 of file connection.cpp.

void Net::Connection::send ( const MessageOut msg  ) 

Sends a message.

Definition at line 90 of file connection.cpp.


Friends And Related Function Documentation

Connection* getConnection (  )  [friend]

Returns a new Connection object.

Should be deleted by the caller.

Definition at line 76 of file network.cpp.


Member Data Documentation

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.

Definition at line 76 of file connection.h.


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

Generated on Sun Apr 26 17:30:44 2009 for The Mana World by  doxygen 1.5.5