Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

oxygen::NetClient Class Reference

#include <netclient.h>

Inheritance diagram for oxygen::NetClient:

Inheritance graph
[legend]
Collaboration diagram for oxygen::NetClient:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 NetClient ()
virtual ~NetClient ()
void SetServer (const std::string &host)
 sets the server to connect to
const std::string & GetServer () const
 returns the server this client connects to
void SetPort (int port)
 sets the port to connect to
int GetPort () const
 returns the port this client connects to
void SetClientType (oxygen::NetControl::ESocketType type)
 sets the client socket type
oxygen::NetControl::ESocketType GetClientType ()
 returns the client socket type
void SendMessage (const std::string &msg)
 prepares the message with the registered NetMessage instance and sends it to the server

Protected Member Functions

bool Connect ()
 tries to connect to the server, returns true on success
void ReadFragments ()
 reads all pending message fragments from the server and stores them in the mNetBuffer
void CloseConnection ()
 closes connection to the server
void ParseMessage (const std::string &msg)
 parses a received message

Protected Attributes

std::string mHost
 the host name of the server
int mPort
 the monitor port to connect to
oxygen::NetControl::ESocketType mType
 the socket type to create
boost::shared_ptr< rcss::net::Socket > mSocket
 the managed TCP socket
boost::shared_ptr< oxygen::NetBuffermNetBuffer
 the receive buffer
boost::shared_ptr< oxygen::NetMessagemNetMessage
 the registered message protocol
int mBufferSize
 the size of the allocated receive buffer
boost::shared_array< char > mBuffer
 the receive buffer

Detailed Description

Definition at line 36 of file netclient.h.


Constructor & Destructor Documentation

NetClient::NetClient  ) 
 

Definition at line 35 of file netclient.cpp.

References mBuffer, mBufferSize, mHost, mNetBuffer, mPort, mType, and oxygen::NetControl::ST_TCP.

NetClient::~NetClient  )  [virtual]
 

Definition at line 45 of file netclient.cpp.


Member Function Documentation

void NetClient::CloseConnection  )  [protected]
 

closes connection to the server

Definition at line 179 of file netclient.cpp.

References zeitgeist::Object::GetLog(), zeitgeist::Leaf::GetName(), mHost, mNetMessage, mPort, and mSocket.

Referenced by SparkMonitorClient::DoneSimulation(), and ReadFragments().

Here is the call graph for this function:

bool NetClient::Connect  )  [protected]
 

tries to connect to the server, returns true on success

Definition at line 79 of file netclient.cpp.

References zeitgeist::Object::GetLog(), zeitgeist::Leaf::GetName(), mHost, mNetMessage, mPort, mSocket, mType, and oxygen::NetControl::ST_UDP.

Referenced by SparkMonitorClient::InitSimulation().

Here is the call graph for this function:

NetControl::ESocketType NetClient::GetClientType  ) 
 

returns the client socket type

Definition at line 74 of file netclient.cpp.

References mType.

int NetClient::GetPort  )  const
 

returns the port this client connects to

Definition at line 64 of file netclient.cpp.

References mPort.

const std::string & NetClient::GetServer  )  const
 

returns the server this client connects to

Definition at line 54 of file netclient.cpp.

References mHost.

void oxygen::NetClient::ParseMessage const std::string &  msg  )  [protected]
 

parses a received message

Reimplemented in SparkMonitorClient.

void NetClient::ReadFragments  )  [protected]
 

reads all pending message fragments from the server and stores them in the mNetBuffer

Definition at line 196 of file netclient.cpp.

References CloseConnection(), zeitgeist::Object::GetLog(), zeitgeist::Leaf::GetName(), mBuffer, mBufferSize, mNetBuffer, and mSocket.

Referenced by SparkMonitorClient::StartCycle().

Here is the call graph for this function:

void oxygen::NetClient::SendMessage const std::string &  msg  ) 
 

prepares the message with the registered NetMessage instance and sends it to the server

Referenced by SparkMonitorClient::InitSimulation().

void NetClient::SetClientType oxygen::NetControl::ESocketType  type  ) 
 

sets the client socket type

Definition at line 69 of file netclient.cpp.

References mType.

void NetClient::SetPort int  port  ) 
 

sets the port to connect to

Definition at line 59 of file netclient.cpp.

References mPort.

void NetClient::SetServer const std::string &  host  ) 
 

sets the server to connect to

Definition at line 49 of file netclient.cpp.

References mHost.


Member Data Documentation

boost::shared_array<char> oxygen::NetClient::mBuffer [protected]
 

the receive buffer

Definition at line 102 of file netclient.h.

Referenced by NetClient(), and ReadFragments().

int oxygen::NetClient::mBufferSize [protected]
 

the size of the allocated receive buffer

Definition at line 99 of file netclient.h.

Referenced by NetClient(), and ReadFragments().

std::string oxygen::NetClient::mHost [protected]
 

the host name of the server

Definition at line 81 of file netclient.h.

Referenced by CloseConnection(), Connect(), GetServer(), NetClient(), and SetServer().

boost::shared_ptr<oxygen::NetBuffer> oxygen::NetClient::mNetBuffer [protected]
 

the receive buffer

Definition at line 93 of file netclient.h.

Referenced by NetClient(), ReadFragments(), and SparkMonitorClient::StartCycle().

boost::shared_ptr<oxygen::NetMessage> oxygen::NetClient::mNetMessage [protected]
 

the registered message protocol

Definition at line 96 of file netclient.h.

Referenced by CloseConnection(), Connect(), and SparkMonitorClient::StartCycle().

int oxygen::NetClient::mPort [protected]
 

the monitor port to connect to

Definition at line 84 of file netclient.h.

Referenced by CloseConnection(), Connect(), GetPort(), NetClient(), and SetPort().

boost::shared_ptr<rcss::net::Socket> oxygen::NetClient::mSocket [protected]
 

the managed TCP socket

Definition at line 90 of file netclient.h.

Referenced by CloseConnection(), Connect(), and ReadFragments().

oxygen::NetControl::ESocketType oxygen::NetClient::mType [protected]
 

the socket type to create

Definition at line 87 of file netclient.h.

Referenced by Connect(), GetClientType(), NetClient(), and SetClientType().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:47:37 2006 for rcssserver3d by  doxygen 1.4.4