All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
net::ClientHandler Class Reference

Server side of the SimDB socket interface. This class provides the client side functions to simplify the connections creation and the messages sending/receiving. More...

#include <ClientHandler.h>

Inheritance diagram for net::ClientHandler:
Inheritance graph
[legend]
Collaboration diagram for net::ClientHandler:
Collaboration graph
[legend]

Public Member Functions

 ClientHandler (const std::string &address, Port port)
 
bool createSocket ()
 
bool startConnection ()
 
void closeConnection ()
 
void sendMessage (const std::string &message)
 
std::string receiveMessage ()
 
char * receiveFile ()
 
- Public Member Functions inherited from net::SocketHandler
 SocketHandler (Port port)
 

Additional Inherited Members

- Static Public Attributes inherited from net::SocketHandler
static const int GENERIC_SOCKET_ERROR = -1
 
static const int DEFAULT_SOCKET_DESCRIPTOR = -1
 
static const Port DEFAULT_INVALID_PORT = -1
 
- Protected Member Functions inherited from net::SocketHandler
int getLastErrorCode ()
 
bool closeSocket (int descriptor)
 
- Protected Attributes inherited from net::SocketHandler
Port serverPort
 
SocketState currentState
 
- Static Protected Attributes inherited from net::SocketHandler
static const int MESSAGE_BUFFER_SIZE = 8192
 
static const char END_OF_MESSAGE = 3
 

Detailed Description

Server side of the SimDB socket interface. This class provides the client side functions to simplify the connections creation and the messages sending/receiving.

Member Function Documentation

void ClientHandler::closeConnection ( )

Close the connection to the server.

bool ClientHandler::createSocket ( )
Returns
true if the socket creation succeeds (through the socket() function), false otherwise.
char * ClientHandler::receiveFile ( )
Returns
Pointer to the base64-encoded file. We use a pointer for efficiency reasons.
string ClientHandler::receiveMessage ( )
Returns
The message received by the server.
void ClientHandler::sendMessage ( const std::string &  message)
Parameters
messageThe message to send to the server.
bool ClientHandler::startConnection ( )
Returns
true if the connection to the server succeeds (through the connect() function), false otherwise.

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